[TxMt] Troubles matching " and ' in language grammar

Charles Turner vze26m98 at optonline.net
Mon Sep 1 20:38:26 UTC 2008


Hi all-

I'm trying to match character constants of the form:

&a &B &!
'c' 'D' '!'
"e" "F" "@"
^G ^h ^+

within the match field of a language grammar.

If I use the search dialog box, this regexp will work for characters 
enclosed in single apostrophes:

((?<=^)|(?<=\s))(([&^]\S)|(\'\S\'))(?=\s)

But it doesn't work when I get it into the match field, I suspect 
because of the framing apostrophes, as in:

{	name = 'constant.character.forth';
	match = '((?<=^)|(?<=\s))(([&^]\S)|(\'\S\'))(?=\s)';
},

Any ideas about what I'm doing wrong, or how I can solve my trouble?

I should also point out that the ungainly:

((?<=^)|(?<=\s))

seems to be necessary inside a language grammar as (?<=\s) alone 
doesn't work, although it does in the search dialog. It matches within 
a line, but not at the beginning of a line. It may be that this is only 
the case with begin/end matching, and not single lines...

Thanks! Charles




More information about the textmate mailing list