[TxMt] Syntax Highlighting regex question

Allan Odgaard allan at macromates.com
Tue Oct 26 13:50:00 UTC 2004


On 26. Oct 2004, at 4:17, Jaime Vargas wrote:

> match = "\\<(action!|any-block!|any-function!|)\\>"
>
> I think this is a problem with the exclamation point "!". I have tried 
> using it with these escape sequences: \!, \\!, \041 \\041; with no 
> luck so far.

The problem is that the exclamation point is not a word character, so 
there is no word boundary after the character, i.e. the pattern should 
be:
    match = "\\<(action!|any-block!|any-function!)"

If you want to guard against word-characters _after_ the exclamation 
point, you could do:
    match = "\\<(action!|any-block!|any-function!)(?!\w)"

But I think only the word-begin-boundary really matters in your case.


Kind regards Allan




More information about the textmate mailing list