MatchRegularExpressionExample1.php
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008 require_once( "_start.php" );
00009
00010
00011 function MatchRegularExpressionExample1()
00012 {
00013 $objMatchRegularExpression = new MatchRegularExpression();
00014 $objMatchRegularExpression->addItem( "M(.*)y" );
00015 $objMatchRegularExpression->addItem( "A(.*)e" );
00016 $objMatchRegularExpression->addItem( "Winter(.*)" , "machine" );
00017 $objMatchRegularExpression->addItem( "^Case$" , "hacker" );
00018
00019 if ( $objMatchRegularExpression->found( "Molly" ) !== true ) return false;
00020 if ( $objMatchRegularExpression->match( "Molly" ) !== true ) return false;
00021 if( $objMatchRegularExpression->match( "Wintermute" ) !== "machine" ) return false;
00022 if( $objMatchRegularExpression->match( "Flatline" ) !== false ) return false;
00023 return true;
00024 }
00025
00026 if( MatchRegularExpressionExample1() === true )
00027 {
00028 print "ok!";
00029 }
00030 else
00031 {
00032 print "fail!";
00033 }
00034 ?>