Sublime Forum

tmLanguage ST2

#1

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.

		<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:

object network myInsideNetwork

How can I apply the keyword.network.object.cisco style to just the (\w+) and not the whole line?

0 Likes

#2

<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 docs.sublimetext.info/en/latest/ … xdefs.html

0 Likes

#3

You’re a lifesaver, thank you! I’ll also review the documentation (which I must have somehow missed the right part of)

0 Likes