Regex match everything but

[亡魂溺海] 提交于 2019-12-10 10:49:16

问题


I would like to create a regular expression to match every word, whitespace, punctuation and special characters in a string except for specific keywords or phrases. Because I only can modify regex, not server code I have to use match instead of replace.

I have something like this so far: (?!(quick|brown|fox|the lazy))\b\w+ but it ignores white spaces and special characters in this tool

Thanks.


回答1:


Does this work for you (?!(quick|brown|fox|the lazy))(\b\w+|[^\w])?

Do you have any examples?



来源:https://stackoverflow.com/questions/3732105/regex-match-everything-but

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!