Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图弄清楚如何匹配除以开头的字符数组之外的所有字符_ah:
_ah
_ah\foo _ah\foo\bar
这是我当前的正则表达式:\b(?!\_ah(\w+))\w+\b
\b(?!\_ah(\w+))\w+\b
然而,这个正则表达式仍然匹配上面列出的那个。我的正则表达式可能有什么问题?
如果您尝试匹配不以_ah..开头的单词
\b(?!_ah)\w+\b
这将匹配foo,bar
foo
bar