⊗ppPmRgAM 249 of 447 menu

Finding All Matches with Regular Expressions in PHP

Using the function preg_match_all you can find out the number of all matches with the regular expression:

<?php $str = 'a aa aaa bbb'; echo preg_match_all('#a+#', $str); // outputs 3 ?>

A string is given. Find out how many numbers are in this string.

byenru