Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.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
有没有办法使用JavaScript查找不匹配的字符?_Javascript_Regex_Function_Match - Fatal编程技术网

有没有办法使用JavaScript查找不匹配的字符?

有没有办法使用JavaScript查找不匹配的字符?,javascript,regex,function,match,Javascript,Regex,Function,Match,最近我发现,我们可以使用这样的正则表达式函数来查找所有元音字符 const vowel = str.match(/[aiueo]/gi); 但是有没有办法使用这个匹配函数找到所有非元音字符 所以当我听到“谢谢”这个词时 它将计算所有非元音字符长度,因此结果为5 也许有人会分享这些信息,我试图在谷歌上找到,但仍然没有找到任何好的解决方案 谢谢将^字符放在字符集前面会使字符集无效 const notVowel = str.match(/[^aiueo]/gi); /[^aiueo]/gi-注意^

最近我发现,我们可以使用这样的正则表达式函数来查找所有元音字符

const vowel = str.match(/[aiueo]/gi);
但是有没有办法使用这个匹配函数找到所有非元音字符

所以当我听到“谢谢”这个词时

它将计算所有非元音字符长度,因此结果为5

也许有人会分享这些信息,我试图在谷歌上找到,但仍然没有找到任何好的解决方案


谢谢

^
字符放在字符集前面会使字符集无效

const notVowel = str.match(/[^aiueo]/gi);

/[^aiueo]/gi
-注意
^