this should be a simple matching problem. i don't know why i can't get it to work right.
basically i need something in php that's equavilent to the perl code:
while($text =~ m/([A-Za-z0-9-]+)/isg) {
#print $1."\n";
push(@terms, $1);
}
i tried using
$ans = preg_match_all("/[A-Za-z0-9-]+/isg", $string, $matches);
it always return 0 on any string.
I am probably using the wrong pattern. could you help me?
I just need a matching that returns an array contains all the words that are made of alphanumeric and "-"
if i give
$string = "a, *sdgh eu eyagy eu7 g-asdg";
i should like it to return
array("a","sdgh","eu","eyagy","eu7","g-asdg");
Thanks!