In snippet, where is $2 in this substitution?
Transformation: ${1/^(\w)|(?:_(\w))/(?1\u$1:)(?2 \u$2:)/g}
Original: ${1:text_in_snail_case}
Output:
Transformation: Text In Snail Case
Original: text_in_snail_case
In snippet, where is $2 in this substitution?
Transformation: ${1/^(\w)|(?:_(\w))/(?1\u$1:)(?2 \u$2:)/g}
Original: ${1:text_in_snail_case}
Output:
Transformation: Text In Snail Case
Original: text_in_snail_case
You can just count the matching groups ?: means the group does not have a number
$0: ^(\w)|(?:_(\w))
$1: (\w) in ^(\w), i.e. first word char after start$2: (\w) in (?:_(\w)), i.e. word char after an underscore/([^%]|%%)*(%.)?.*/
in the above expression,
$0:/([^%]|%%)*(%.)?.*/
$1:([^%]|%%)*
$2:(%.)?
$3:.*
am I right?
/ is not part of the expression so it would be $0:([^%]|%%)*(%.)?.*
also the matching groups are creating with parens so $3 would not exists and I am not sure what would be the content of $1, because the * is outside of the paren.
In general I would write something like that with ((?:[^%]|%%)*), i.e. you use ?: to not create a matching group, but create the matching group around the whole expression you want to match.