php - Match sub-strings that start with a character -
i want match parts of string start character (asterisk):
abc*defxyz => *def
abc*de*fxyz => *de, *f
tried preg_match_all('/[$\*a-z]+/', $string, $matches); doesn't seem work. *de*f on 2nd example
change regex : \*[a-z]+
your regex here : [$\*a-z]+ means string containing * , a-z characters, not mentioning start.
Comments
Post a Comment