Is there a way to get the number of regex matches in a string?
[man]preg_match_all[/man]
OK, I've been playng around with this for a couple of hours and I'm very new to regex's so could you show me how to get the number of matches using this? or any other method would also be helpful, thanks in advance.
Maybe you want to look at;[man]substr_count[/man]
Originally posted by easethan how to get the number of matches using this?
[man]preg_match_all[/man] Returns the number of full pattern matches (which might be zero), or FALSE if an error occurred.
I admit, it's not something I often use - I'm just as likely to just count() the returned array.