Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 匹配一个没有连续字符的单词_Regex_Regex Negation - Fatal编程技术网

Regex 匹配一个没有连续字符的单词

Regex 匹配一个没有连续字符的单词,regex,regex-negation,Regex,Regex Negation,我不熟悉java正则表达式。你能为以下要求提供一个匹配的模式吗。 例子: 苹果和谷歌不应该被匹配,因为它们有连续的字符。 但是,像Hard2Crack或有时这样的词应该匹配 非常感谢您的帮助。您可以使用此正则表达式: ^(?:(.)(?!\1))*$ 你可以试试这个。用一个负片 见演示 至少尝试一些东西来表明你的努力 (?!.*?([a-z])\1)^.*$

我不熟悉java正则表达式。你能为以下要求提供一个匹配的模式吗。 例子: 苹果和谷歌不应该被匹配,因为它们有连续的字符。 但是,像Hard2Crack或有时这样的词应该匹配


非常感谢您的帮助。

您可以使用此正则表达式:

^(?:(.)(?!\1))*$
你可以试试这个。用一个负片

见演示


至少尝试一些东西来表明你的努力
(?!.*?([a-z])\1)^.*$