regex solution ?
Posted: Wed Apr 22, 2009 11:11 pm
How to check/match the following case using regex:
Code: Select all
$string = 'test #any_word';
//other cases:
//$string = 'test test #any_word';
//$string = 'test test test #any_word';
//$string = 'test test test ... #any_word';
if(preg_match('/pattern goes here.../', $string){
echo 'Matched';
}else{
echo 'Not Matched';
}