Greedy Group problem
Posted: Mon Nov 22, 2010 3:40 pm
I'm making a global change to my source file. I have a macro to make the changes, however I'd like to attempt using a regular expressions. I'm having issues with the syntax, however.
I want to simply replace all my functions with the exact same line followed by an added subroutine.
original:
---
function xyz
---
replaced with:
---
function xyz
statistics_routine
---
I can match the function and linefeed alright, but the first group match (\1) simply returns the exact string -- "\1" rather than the match. I did switch to POSIX format, but that didn't help.
My fields are
find:
^function.*\n
replace:
\1\nstatistics_routine
Thanks in advance,
dgp
I want to simply replace all my functions with the exact same line followed by an added subroutine.
original:
---
function xyz
---
replaced with:
---
function xyz
statistics_routine
---
I can match the function and linefeed alright, but the first group match (\1) simply returns the exact string -- "\1" rather than the match. I did switch to POSIX format, but that didn't help.
My fields are
find:
^function.*\n
replace:
\1\nstatistics_routine
Thanks in advance,
dgp