Re: [pcre-dev] [Bug 1380] Report match when doesn't match an…

トップ ページ
このメッセージを削除
著者: Jean-Christophe Deschamps
日付:  
To: pcre-dev
題目: Re: [pcre-dev] [Bug 1380] Report match when doesn't match and vice-versa

Zoltan,

     Hi, you don't need a new syntax rule for that. I recommend to use
     (*SKIP).
     E.g: find a B if there is no A within 0..6 character before that. A
     pcretest
     example:
       re> /A.{0,6}(*SKIP)(*FAIL)|B/
     data> ABBBBBB
     No match
     data> ABBBBBBB
      0: B


Now suppose the subject is a flat file containing lines with some
expected format, let's say for instance that lines must start with a
date in aaaa/mm/jj format.
It's dead simple to loop and list only lines which do follow the
expected format.
How would you make a pattern to extract lines that violate the format?
In my scripting language I only have access to a couple of wrapper
functions:
[1]http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm
and
[2]http://www.autoitscript.com/autoit3/docs/functions/StringRegExpRepl
ace.htm
I can still replace every matching line by an empty string but I find
this workaround rather inelegant and difficult to use in less simple
situations.

--
[3]jcd@???

References

1. http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm
2. http://www.autoitscript.com/autoit3/docs/functions/StringRegExpReplace.htm
3. mailto:jcd@q-e-d.org