JavaScript RegExp – [^aeiou] 描述 [^aeiou] 匹配一个不在给定集合内的单个字符。 示例 以下示例展示了 RegExp 表达式的使用。 <html> <head> <title>JavaScript RegExp</title> </head> <body> <script type = "text/javascript"> var str = "first alphabet"; var pattern = /[^abcde]/g; var result = str.match(pattern); document.write("Test 1 - 返回值 : " + result); str = "second"; result = str.match(pattern); document.write("<br/>Test 2 - 返回值 : " + result); </script> </body> </html>HTMLCopy 输出 Test 1 - 返回值 : f,i,r,s,t, ,l,p,h,t Test 2 - 返回值 : s,o,nHTMLCopy