Regular Expression to exclude set of Keywords

后端 未结 7 1738
一个人的身影
一个人的身影 2020-11-30 22:54

I want an expression that will fail when it encounters words such as \"boon.ini\" and \"http\". The goal would be to take this expression and be able to construct for any se

7条回答
  •  鱼传尺愫
    2020-11-30 23:30

    Which language/regexp library? I thought you question was around ASP.NET in which case you can see the "negative lookhead" section of this article: http://msdn.microsoft.com/en-us/library/ms972966.aspx

    Strictly speaking negation of a regular expression, still defines a regular language but there are very few libraries/languages/tool that allow to express it.

    Negative lookahed may serve you the same but the actual syntax depends on what you are using. Tim's answer is an example with (?...)

提交回复
热议问题