Web >> Development >> PHP >> How to match a pattern more than once

preg_match_all($string,$pattern,$matches,PREG_PATTERN_ORDER) $matches[0] is an array of full matches $matches[1] is an array of strings matched by the first parenthesized subpattern, and so on. or preg_match_all($string,$pattern,$matches,PREG_SET_ORDER) Orders results so that $matches[0] is an array of first set of matches, $matches[1] is an array of second set of matches, and so on. for pattern use /patterntosearch/m when searching file with multiple lines