Sublime Forum

Nested capture groups working with regex

#1

Hello,

I want to do the following:

Given this string “(something somethingelse morethings anotherthing otherthing)”

I want to transform it in “(‘something’ 'somethingelse ‘morethings’ ‘anotherthing’ ‘otherthing’)”

So i have the following regexp to match the original string:

({1}((\w+)(\s){0,1})+){1}

My question is how can I reference the first group inside tha major group, in the regular expression?
I mean the group (\w+).

0 Likes