0

メッセージから文字列「VSS」を除外したい

VSS ライタがメモリ不足になりました

パターンマッチに使用している正規表現は

[O,o]ut of [M,m]emory

しかし、VSS がメッセージに含まれている場合は、そのメッセージ全体を除外したいと考えています。これは可能ですか?

4

1 に答える 1

3

これは、否定先読みアサーションを使用して解決できます。

(?i)^(?!.*VSS).*out of memory

説明:

(?i)           # Make the regex case-insensitive
^              # Match the start of the string
(?!.*VSS)      # Assert that there is no "VSS" in the string
.*             # Match any number of characters
out of memory  # Match "out of memory"

ちなみに、 はan 、 anまたは a[O,o]に一致するため、おそらく意図したとおりではありません。Oo ,

于 2012-05-21T10:43:38.697 に答える