How can I replace the words like:
something(name_one,name_two).
into
something(name_two,name_one).
I've tried something like ^(.+),(.+)$
and replace with \2,\1
, but not success and it turns out to be like this:
name_two).,something(name_one
You have to exclude from the capturing groups what you don't want to be swapped.
Replace
something\((.+),(.+)\)
with
something(\2,\1)
(see demo)
Or
Replace
\((.+),(.+)\)
with
(\2,\1)
(see demo)
Please notice that \(
and \)
are escaped parentheses, so they will match literally an open parenthesis and a closed one.