On Thu, 21 Jun 2012 05:59:43 +0200 Roland Mainz wrote:
> Grrr... ([^><]+)+? is the correct pattern... I wish ksh would've hit
> me with an error message (which may not be allowed by the standard) or
> at least refuse to match anything with a faulty pattern like that...

[^[><]] was only faulty because it did what it was supposed to do,
not what you intended

in particular the posix shell is intentionally lenient on non-matched [ and ] 
chars
these are two valid patterns
        a[b
        c]d
that happen to match literal [ and ] respectively

> Sorry for the mess... ;-(
> ... AFAIK the only real bug may then be
> https://mailman.research.att.com/pipermail/ast-developers/2012q2/001402.html
> (maybe the regex engine was confused by the faulty pattern ?)

re that mail - yes, it didn't work because of the malformed [^...]
but even for ERE it was syntactically correct
so again it was not regex that was confused

you can test any RE with $INSTALLROOT/src/cmd/re/testregex on this test line
(preserve the tabs) if there were a regcomp() syntax error testregex would 
complain
--
E       (?:([^[><]]+)+?)        x]      (0,2)(0,2)
--

all interested in (weird|complicated|obscure) REs should look at the testregex
input data src/cmd/re/*.dat -- and please feel free to add to that corpus

_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to