diff --git a/Example.php b/Example.php new file mode 100644 index 00000000..fd0474e8 --- /dev/null +++ b/Example.php @@ -0,0 +1,38 @@ +startOfLine() + ->then( "http" ) + ->maybe( "s" ) + ->then( "://" ) + ->maybe( "www." ) + ->anythingBut( " " ) + ->endOfLine(); + + +if($regex->test("http://github.com")) + echo "valid url"; +else + echo "invalid url"; + +if (preg_match($regex, 'http://github.com')) { + echo 'valid url'; +} else { + echo 'invalud url'; +} + +echo "
". $regex->getRegex() ."
"; + + +echo $regex ->clean(array("modifiers"=> "m","replaceLimit"=>4)) + ->find(' ') + ->replace("This is a small test http://somesite.com and some more text.", "-"); diff --git a/VerbalExpressions.php b/VerbalExpressions.php index 31ea6fc6..8174f84d 100644 --- a/VerbalExpressions.php +++ b/VerbalExpressions.php @@ -6,38 +6,6 @@ */ -// // some tests - -// $regex = new VerEx; - -// $regex ->startOfLine() -// ->then( "http" ) -// ->maybe( "s" ) -// ->then( "://" ) -// ->maybe( "www." ) -// ->anythingBut( " " ) -// ->endOfLine(); - - -// if($regex->test("http://github.com")) -// echo "valid url"; -// else -// echo "invalid url"; - -// if (preg_match($regex, 'http://github.com')) { -// echo 'valid url'; -// } else { -// echo 'invalud url'; -// } - -// echo "
". $regex->getRegex() ."
"; - - -// echo $regex ->clean(array("modifiers"=> "m","replaceLimit"=>4)) -// ->find(' ') -// ->replace("This is a small test http://somesite.com and some more text.", "-"); - - class VerEx { public $prefixes = "";