Regular Expression to exclude set of Keywords

后端 未结 7 1726
一个人的身影
一个人的身影 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:32

    you might be well served by writing a regex that will succeed when it encounters the words you're looking for, and then invert the condition.

    For instance, in perl you'd use:

    if (!/boon\.ini|http/) {
        # the string passed!
    }
    

提交回复
热议问题