[nzlug] Hard regexp question
Nick 'Zaf' Clifford
zaf at nrc.co.nz
Mon Aug 6 17:45:28 NZST 2007
Martin D Kealey wrote:
<snip>
> Note we don't check that the each character is NOT a backslash; this can be
> guaranteed, since the alternation won't backtrack, and we avoid the singular
> exception of a trailing backslash at the end of input because we insist that
> it finishes with a double quote. In general though you'd probably want to
> write
>
> /"
> (
> (?> \s* [^ "] )
> ( \\. | [^"\\] )+
> )
> "/x
>
> Note the trailing /x, which make the whole thing a bit less of a write-only
> language (hopefully!).
>
>
/me bows to your superior regex skills and geekyness factor.
Nick
More information about the NZLUG
mailing list