his 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
Dear all,
Thanks for all comments and tips on my "Conditional regex" question. Nevertheless I'm still a bit of a novice when it deals with regular expressions. Although I can see the logic in many of your tips I'm still unable to put the bits and pieced together into a functional expression.
Would anyone of you be so kind to provide me with a more elaborate answer/example?
Thanks,
Marc
On Wed, May 27, 2009 at 7:30 AM, Dijk van Marc marcvdijk@gmail.com wrote:
Would anyone of you be so kind to provide me with a more elaborate answer/example?
{ name = 'meta.test'; match = '^(ATOM|HETATM).*(GLN)'; captures = { 1 = { name = 'keyword.first-match'; }; 2 = { name = 'string.second-match'; }; }; }
This should color each match differently. Please note that there are many different ways to do this and may not be the best way for your needs.
Do yourself a favor and look up some regex tutorials on the web. They will help immensely.
--oliver