Permalink
Browse files

correcting address comma regex

  • Loading branch information...
1 parent 9baa160 commit f76251fa48f0e8396bbdc301eedbe978fc8af601 @viveleroi committed Oct 14, 2010
Showing with 5 additions and 3 deletions.
  1. +1 −1 Peregrine.php
  2. +4 −2 PeregrineTest.php
View
@@ -614,7 +614,7 @@ public function getName($key = false, $default = NULL){
public function getAddress($key = false, $default = NULL){
$default = $default === NULL ? false : $default;
if($this->isSetAndNotEmpty($key)){
- return preg_replace('/[^a-zA-Z0-9-[:space:]\.\'#&]/', '', $this->getKey($key));
+ return preg_replace('/[^a-zA-Z0-9-[:space:]\.\'#,&]/', '', $this->getKey($key));
}
return $default;
}
View
@@ -465,27 +465,29 @@ public function test_isName() {
*
*/
public function test_getAddress() {
- $my_arr = array('123 Fake Street','?','','050 P.0.-BOX CROSS & CROSS', '?^*@!%<>{}[]()');
+ $my_arr = array('123 Fake Street','?','','050 P.0.-BOX CROSS & CROSS', '?^*@!%<>{}[]()','BOX A, BOX B');
$arr = Peregrine::sanitize( $my_arr );
$this->assertEquals('123 Fake Street', $arr->getAddress(0));
$this->assertEquals('', $arr->getAddress(1));
$this->assertEquals('', $arr->getAddress(2));
$this->assertEquals('050 P.0.-BOX CROSS & CROSS', $arr->getAddress(3));
$this->assertEquals('', $arr->getAddress(4));
+ $this->assertEquals('BOX A, BOX B', $arr->getAddress(5));
}
/**
*
*/
public function test_isAddress() {
- $my_arr = array('123 Fake Street','?','','050 P.0.-BOX CROSS & CROSS', '?^*@!%<>{}[]()');
+ $my_arr = array('123 Fake Street','?','','050 P.0.-BOX CROSS & CROSS', '?^*@!%<>{}[]()','BOX A, BOX B');
$arr = Peregrine::sanitize( $my_arr );
$this->assertEquals(true, $arr->isAddress(0));
$this->assertEquals(false, $arr->isAddress(1));
$this->assertEquals(false, $arr->isAddress(2));
$this->assertEquals(true, $arr->isAddress(3));
$this->assertEquals(false, $arr->isAddress(4));
+ $this->assertEquals(true, $arr->isAddress(5));
}

0 comments on commit f76251f

Please sign in to comment.