/home/thiagomata/thiagomata.com/codetodiagram/svn/components/match/MatchGroup.class.php
Class what combine a name match with a regular expression match
Thiago Henrique Ramos da Mata <thiago.henrique.mata@gmail.com>
- Since:
- 2009-06-12
$objMatch = new MatchGroup(); $objMatch->addItemName( "Flatline" ); $objMatch->addItemName( "Matrix" ); $objMatch->addItemName( "Wintermute" , "artificial" ); $objMatch->addItemName( "Case" , "hacker" ); $objMatch->addItemRegularExpression( "M(.*)y" ); $objMatch->addItemRegularExpression( "A(.*)e" ); $objMatch->addItemRegularExpression( "Winter(.*)" , "machine" ); $objMatch->addItemRegularExpression( "^Case$" , "cowboy" ); if ( $objMatch->found( "Molly" ) !== true ) return false; if ( $objMatch->match( "Molly" ) !== true ) return false; if ( $objMatch->match( "Wintermute" ) !== "artificial" ) return false; if ( $objMatch->match( "Wintertime" ) !== "machine" ) return false; if ( $objMatch->match( "Case" ) !== "hacker" ) return false; if ( $objMatch->match( "Jackson" ) !== false ) return false; return true; }