Home Download Buy Blog Forum Support

multiline regex for tmLanguage

multiline regex for tmLanguage

Postby tgkeul on Mon Jun 07, 2010 8:55 pm

I have to maintain some legacy Oracle PL/SQL code. I prepared my personal plSQL.tmLanguage to detect constructs like "create or replace package abc.xyz is". I have a regex which highlights the keywords and the identifier .

Unfortunately some of the legacy code has "random" newlines between the words, e.g.
"create or replace
package abc.xyz is"
My attempt was to insert an optional "\n*" in my regex as shown below.
Code: Select all
\b(create\s+(or\s+replace\s+)?\n*\s*package\s+(body\s+)?)(([a-z][a-z0-9_#\$]*\.)?([a-z][a-z0-9_#\$]*))\b

This will work with "The Regex Coach" I use to verify my regexes.
This does not work with sublime. :cry:

Is there any chance to get a regex to span multiple lines?
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: multiline regex for tmLanguage

Postby guillermooo on Mon Jun 07, 2010 9:56 pm

As far as I know, syntax regexes not consuming the newline char is a design choice in TextMate for efficiency.

If you need to style multiple lines, I believe your only option would be to define a begin..end rule.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: multiline regex for tmLanguage

Postby tgkeul on Tue Jun 08, 2010 5:09 am

Hmm, the regex above is the begin of a begin..end rule.

It will be very tedious to integrate possible newlines in rules as they can occure where whitespace is possible.
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests