Help with replacing functions myfunc(param1,0,param3) ----> myfunc(param1,param3,0,param3)

10 views
Skip to first unread message

Explorer

unread,
May 27, 2014, 5:10:30 PM5/27/14
to re...@googlegroups.com
Hi All,

Was looking fr a way to do the following replacement using regex

myfunc(param1,0,param3) ----> myfunc(param1,param3,0,param3)

([^,_]+),_([^,_]+),_([^,_]+),_([^,_]+) 

The above should help me get the param 3, however not sure how to replace using grouping constructs (\1,\2) etc

iiz

unread,
Jun 27, 2014, 8:14:12 AM6/27/14
to re...@googlegroups.com
Search for
(?=\()([^)]*),([^)]*),([^)]*)(?=\))

replace with
\1,\3,\2,\3

basically you are looking for a string between brackets, not counting the brackets. Then creating numbered groups for backreferencing. Then you reference them in the replace query.


Op dinsdag 27 mei 2014 23:10:30 UTC+2 schreef Explorer:
Reply all
Reply to author
Forward
0 new messages