English 中文(简体)
除非是足球队,否则定期表达寻找磨损的言辞
原标题:Regular expression for finding swear words unless they are football teams

In AS3, I have created a nice swear filter routine that imports a list of regular expressions for swear words and combines them into a single regular expression. However, one bit I m having problem over are football teams, namely ARSENAL and SCUNTHORPE.

是否有办法阻止密码unless。 他们完成了上述措辞? 我与索马里再次解放联盟一起尝试了以下几个方面,但并未适当开展工作:

/arse[^(nal)]/gi

问题是,我不能将“最后”信作为括号,因为它认为母体是个性,而不是一个障碍。 似乎期望在“ars”之后至少有一个额外性才能工作。 Can 我这样说,它会允许一个而不是另一个? 我怎么能够把信件集中起来,说“不是”?

EDIT:我在Stack的其他地方看到了一些“消极的 look头”,但是,我怎么能为这两个使用案例做。 任何想法?

最佳回答

我没有具体了解行动说明,但在大多数雷克斯发动机中,你可以使用。

负光头:?

背后:?<!

代表Arsenal:

/arse(?!nal)/gi 

And Scunthorp or sHAPPYhorp:

/HAPPY(?<!sHAPPY)(?!horp)/gi 

Sc与HAPPYhorp相似,作为读者的任务留待。

问题回答

仅使用<条码>的字句:<条码>:<条码>。

当然,你必须处理这些ba**ar* 绕过你的“f-*”-ng 规则的vent。





相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...