Reputation: 695
Considering the string
aaa"bbb"
And the REGEX
(?<first>.+?(?="))"(?<first>.+?(?="))
We have the named capturing group
'first' => aaa
'second' => bbb
I want, as result a duplicated capturing group with the same value, like:
'first' => aaa
'duplicated' => aaa
'second' => bbb
Do you know how can we do this?
Upvotes: 2
Views: 1821
Reputation: 5268
Just put a "duplicated" capture group inside the "first" capture group.
(?<first>(?<duplicated>.+?(?=")))"(?<second>.+?(?="))
Upvotes: 4
Reputation: 441
I don't understand you at all, but with this pattern you can get your values:
Expresion: ^([^\"]*)\"([^\"]*)\"$
String: aaaa"bbb"
Replace: $1__$1__$2
Result: aaaa__aaaa__bbb
More info, use
http://www.metriplica.com/es/recursos/expresiones-regulares
Upvotes: -1