php - Two or more matches in expression -


Is it possible to create two matches of the text - / 123/123/123? Edit

Find me on 123 , 123 , 123 and edit < / P> is required to match

first (123,123,123): the pattern is - ([^ \ /] +)
(edit) for the second: the pattern is - < Code> ([^ \? =] * $)

Is it possible to match in a preg_match_all function, or I have to do it twice - a pattern For once, the second one for the other?

Thank you!

You can do this with a call:

  $ String = '/ 123/123/123' edit '; $ Matches = array (); Preg_match_all ('# (? & Lt; = [/?]) \ W + #', $ string, $ matches); / $$ will match: Array ([0] => Array ([0] => 123 [1] => 123 [2] => 123 [3] => Edit View in action on  

Pattern ( (? & Lt; = [/?]) \ W + /

) It uses either to claim one, either a slash or a question mark should be before a sequence of letters ( \ w [a-z0- 9_] < / Code>).


Comments