This is the regular test tool that I can correctly match, why put to Preg_match_all ('/(\@[a-z]+\|[ \u4e00-\u9fa5]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+)/is ', $a) is not good? Test tool Inside I choose the global search is OK, not select is not, is this the reason? Preg_match_all not a global search?
Reply to discussion (solution)
Several questions
1.preg_match_all (Regular, string, result), you have only two parameters above
2. Is your parameter split comma full-width?
3.\u changed into \x
/(\@[a-z]+\| [\u4e00-\u9fa5]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+)/is U
Since you have Unicode characters in the rule string, you must have the U modifier
The correct wording is:
/(\@[a-z]+\| [\x{4e00}-\x{9fa5}]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+]/isu
The correct wording is:
/(\@[a-z]+\| [\x{4e00}-\x{9fa5}]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+]/isu
Why the final result $res (the third argument) is a two-dimensional array with two elements, and the contents of the two elements are the same?
$res [0] $res [1]
The correct wording is:
/(\@[a-z]+\| [\x{4e00}-\x{9fa5}]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+]/isu
Thank you for the results. Already, ask, why I before those online test tools inside test this rule, can get the correct match, put in the file is not allowed?
@[a-z]+\| [\u4e00-\u9fa5]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+
This \u4e00-\u9fa5 is a Unicode-encoded Chinese section, so you can see that your test tool is in the form of a Web page.
The regular engine of PHP does not recognize this format, and naturally it will not get the correct results.
The correct wording is:
/(\@[a-z]+\| [\x{4e00}-\x{9fa5}]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+]/isu
Thank you for the results. Already, ask, why I before those online test tools inside test this rule, can get the correct match, put in the file is not allowed?
@[a-z]+\| [\u4e00-\u9fa5]+\| [a-z]+\| [a-z]+\| [a-z]+\| [0-9]+
The online test or browser plugin is not PHP engine, may be the JS engine inside the regular