[Lazarus] Regexp syntax
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Jun 15 14:55:36 CEST 2010
On Tue, 15 Jun 2010 15:21:52 +0300
Juha Manninen <juha.manninen at phnet.fi> wrote:
> > > but I am sure it could be written in a cleaner way.
> >
> > ^Tnt(([^L]|.[^X]).+)
>
> Hmmm... It doesn't look very clean. It may be more correct but I am not sure
> of that.
It is not very clean. It does not match TntL and TntL1.
> Does [^L]|.[^X] mean:
> anything but 'L' or anything, followed by anything but 'X' ?
The pipe is like an 'or' operator. [^L]|.[^X] means:
Any character but L OR any character followed by any character but X.
It matches a, b, La, Lb, but not LX and not L.
Even better regexp is:
^Tnt(([^L]|L[^X]).*|L$)
Mattias
More information about the Lazarus
mailing list