简体   繁体   中英

Match all characters except for those that start with specific characters

I'm trying to figure out how to match all characters except for character array that starts with _ah :

_ah\foo
_ah\foo\bar

This is my current regex: \\b(?!\\_ah(\\w+))\\w+\\b

However this regex still matches the one listed above. What could be the problem in my regex?

If you are trying to match words that don't start with _ah ..

\b(?!_ah)\w+\b

This would match foo , bar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM