File tree Expand file tree Collapse file tree 3 files changed +516
-514
lines changed Expand file tree Collapse file tree 3 files changed +516
-514
lines changed Original file line number Diff line number Diff line change 5
5
* 22.July.2013
6
6
*/
7
7
8
- require_once ( 'VerbalExpressions.php ' ) ;
8
+ require_once 'VerbalExpressions.php ' ;
9
9
10
+ $ regex = new \VerbalExpressions \PHPVerbalExpressions \VerbalExpressions ();
10
11
11
- $ regex = new VerEx ;
12
-
13
- $ regex ->startOfLine ()
14
- ->then ( "http " )
15
- ->maybe ( "s " )
16
- ->then ( ":// " )
17
- ->maybe ( "www. " )
18
- ->anythingBut ( " " )
19
- ->endOfLine ();
20
-
12
+ $ regex ->startOfLine ()
13
+ ->then ("http " )
14
+ ->maybe ("s " )
15
+ ->then (":// " )
16
+ ->maybe ("www. " )
17
+ ->anythingBut (" " )
18
+ ->endOfLine ();
21
19
22
20
if ($ regex ->test ("http://github.com " ))
23
- echo "valid url " . '<br> ' ;
21
+ echo "valid url " . '<br> ' ;
24
22
else
25
- echo "invalid url " . '<br> ' ;
23
+ echo "invalid url " . '<br> ' ;
26
24
27
25
if (preg_match ($ regex , 'http://github.com ' )) {
28
- echo 'valid url ' ;
26
+ echo 'valid url ' ;
29
27
} else {
30
- echo 'invalud url ' ;
28
+ echo 'invalud url ' ;
31
29
}
32
30
33
31
echo "<pre> " . $ regex ->getRegex () ."</pre> " ;
34
32
35
-
36
- echo $ regex ->clean (array ("modifiers " => "m " ,"replaceLimit " =>4 ))
37
- ->find (' ' )
38
- ->replace ("This is a small test http://somesite.com and some more text. " , "- " );
33
+ echo $ regex ->clean (array ("modifiers " => "m " , "replaceLimit " => 4 ))
34
+ ->find (' ' )
35
+ ->replace ("This is a small test http://somesite.com and some more text. " , "- " );
Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ VerbalExpressions is a PHP library that helps to construct hard regular expressi
8
8
9
9
// some tests
10
10
11
- $regex = new VerEx ;
11
+ $regex = new VerbalExpressions ;
12
12
13
13
$regex ->startOfLine()
14
- ->then( "http" )
15
- ->maybe( "s" )
16
- ->then( "://" )
17
- ->maybe( "www." )
18
- ->anythingBut( " " )
14
+ ->then("http")
15
+ ->maybe("s")
16
+ ->then("://")
17
+ ->maybe("www.")
18
+ ->anythingBut(" ")
19
19
->endOfLine();
20
20
21
21
@@ -35,7 +35,7 @@ echo "<pre>". $regex->getRegex() ."</pre>";
35
35
36
36
37
37
38
- echo $regex ->clean(array("modifiers"=> "m","replaceLimit"=> 4))
38
+ echo $regex ->clean(array("modifiers" => "m", "replaceLimit" => 4))
39
39
->find(' ')
40
40
->replace("This is a small test http://somesite.com and some more text.", "-");
41
41
You can’t perform that action at this time.
0 commit comments