Re-opening this old thread with a very very similar question.
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.
<string>(?:object network) (\w+)</string>
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?