[TxMt] Re: Conditional regex

Dijk van Marc marcvdijk at gmail.com
Sat May 23 13:09:10 UTC 2009


> Is this what you mean?
>
>    ^(ATOM|HETATM).*GLN
>
> This will match any line which starts with either 'ATOM' or 'HETATM',
> followed by any string of arbitrary characters, followed by the string
> 'GLN'.

This indeed works but I do think I need to be a bit more specific.
Lets look again at the line:

ATOM     14  CA  GLN A   2     -27.648  -9.581  30.325  1.00 10.00

My goal is to have both the 'ATOM' string and the 'GLN' string colored
differently.

Using ^(ATOM|HETATM)\b I can color the ATOM part.
Using \bGLN\b I can color the GLN part.

The problem is that I only want the GLN part to be colored if the line
starts with ATOM. In your reply the complete part starting with ATOM
up to GLN gets colored.

Marc



More information about the textmate mailing list