Home >Backend Development >PHP Tutorial >一个关于正则语法的问题

一个关于正则语法的问题

WBOY
WBOYOriginal
2016-06-23 14:39:40784browse

我想要使用正则匹配3个不同的字符 我的思路是这样
(\w)([^\1])[^\1\2]

但是[^\1] 这样的语法似乎是错误的 求教 应该怎么修改??


回复讨论(解决方案)

(?:(\w)(?!.*?\1)){3}

$reg = '#(\w)((?!\1)\w)((?!\1|\2)\w)#';preg_match_all($reg,"111 121 321 122 456 aca abc caa aab",$m);print_r($m[0]);

Statement:
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