Home > Backend Development > PHP Tutorial > 正则表达式匹配错误

正则表达式匹配错误

WBOY
Release: 2016-06-06 20:22:18
Original
1752 people have browsed it

<code>preg_match("/^@\w+(#|:| ){1}$/", "content=#作曲家#看那你面的罢了:stuck_out_tongue_closed_eyes:@000000a ", $matches, PREG_OFFSET_CAPTURE);
</code>
Copy after login
Copy after login

我想匹配"@000000a",但结果不正确,希望懂的人可以指点一下,非常感谢!
content中的内容出现的顺序是随机的。

回复内容:

<code>preg_match("/^@\w+(#|:| ){1}$/", "content=#作曲家#看那你面的罢了:stuck_out_tongue_closed_eyes:@000000a ", $matches, PREG_OFFSET_CAPTURE);
</code>
Copy after login
Copy after login

我想匹配"@000000a",但结果不正确,希望懂的人可以指点一下,非常感谢!
content中的内容出现的顺序是随机的。

pregmatch(“/@(\w+)/”)

<code>preg_match("/@([0-9]+[A-Za-z]+)(#|:| )+$/", "content=#作曲家#看那你面的罢了:stuck_out_tongue_closed_eyes:@000000a#", $matches);
echo "<pre class="brush:php;toolbar:false">";
print_r($matches);
echo "
Copy after login
";

正则表达式匹配错误

/@\d+\w+/ 或者 /@[0-9]+[a-zA-Z]+/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template