Im trying to expand a search util by uing regular expression to allow
common search criteria such as +-* and phrases "".
My understanding of ereg(string pattern, string string, [array
registers]) is that the array register should collect all instances
that match the pattern.
Heres is an example of the code:
$word4 = "+budgie +ferret dog."; //set phrase
$regexp = "\+[0-9A-Za-z]+"; //assign pattern
if(ereg($regexp, $word4, $reg)){ //test for true result
for($i=0;$i<count($reg);$i++){ //loop through array result
echo "<b>finding multiple instances.:</b> Found string '$reg
[$i]'<br>"; // echo result
}
}else{
echo "<b>finding multiple instances.:</b> $regexp not found"; //
echo if none found
}
This is succesfully finding the first word but id does not find the
second word.
Can anyone point to where im going wrong?
Regards
Tristan