Home Download Buy Blog Forum Support

tmLanguage ST2

tmLanguage ST2

Postby ILikeVoltron on Sat Feb 02, 2013 11:37 pm

I wrote up a new thread for this with a very very similar question from another thread

I'm using the below regex to match just the (\w+), not the whole line. I'm doing this with a (?:...) as described in the documentation as a "not captured group" but I've also tried the previously mentioned (?=...) as well with similar failures.

Code: Select all
      <dict>
         <key>match</key>
         <string>(?:object network) (\w+)</string>
         <key>name</key>
         <string>keyword.network.object.cisco</string>
      </dict>


The above code matches the entire line below:

Code: Select all
object network myInsideNetwork


How can I apply the keyword.network.object.cisco style to just the (\w+) and not the whole line?
ILikeVoltron
 
Posts: 6
Joined: Mon Jan 28, 2013 6:26 am

Re: tmLanguage ST2

Postby FichteFoll on Sun Feb 03, 2013 12:02 am

Code: Select all
<dict>
    <key>match</key>
    <string>(?:object network) (\w+)</string>
    <key>name</key>
    <string>some.scope.that.applies.to.the.entire.match</string>
    <key>captures</key>
    <dict>
        <key>1</key>
        <dict>
            <key>name</key>
            <string>keyword.network.object.cisco</string>
        </dict>
    </dict>
</dict>


See http://docs.sublimetext.info/en/latest/ ... xdefs.html
FichteFoll
 
Posts: 386
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: tmLanguage ST2

Postby ILikeVoltron on Sun Feb 03, 2013 1:00 am

You're a lifesaver, thank you! I'll also review the documentation (which I must have somehow missed the right part of)
ILikeVoltron
 
Posts: 6
Joined: Mon Jan 28, 2013 6:26 am


Return to General Discussion

Who is online

Users browsing this forum: prmaple, Yahoo [Bot] and 31 guests