Is there a way to make Sublime Text highlight (match) only part of a regex search pattern?
For example, I want to exclusively highlight Text
when searching for Some(Text)
.
Difficulty in getting a regex application to work will probably have a regex solution. In this case, lookarounds.
Example using a lookbehind:
Sample:
SomeText
Regex:
(?<=Some)(Text)
Match:
Text
(Text)
, you need to escape the parentheses so the regex should be (?<=Some)\(Text\)
Commented
Nov 4, 2015 at 15:29
You can use:
(?<=preceeding_enclosing_text)your_searched_text(?=following_enclosing_text)
In your particular example:
(?<=Some\().+?(?=\))