I'm working on this regex:
/\{(\w+)::(\w+)::([\sa-zA-Z0-9]+)\}/
So, from a long string, I could get patterns like: Word::Word::Word and word and word
I've tested this regex here: http://regex101.com/
And in PHP it sais it should work fine.
But when I put into code, it doesn't work:
$pattern = '/\{(\w+)::(\w+)::([\sa-zA-Z]+)\}/';
echo preg_match_all(preg_match_all($pattern,'{WORD::WORD::PRUEB ASDF ASD}', $expr,PREG_PATTERN_ORDER));
the echo result is 0
You are calling preg_match_all inside preg_match_all. Do this instead:
$pattern = '/\{(\w+)::(\w+)::([\sa-zA-Z]+)\}/';
echo preg_match_all($pattern,'{WORD::WORD::PRUEB ASDF ASD}', $expr, PREG_PATTERN_ORDER);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.