Jason Dusek wrote:

> I need to write a script that finds the uniq() function in code for a
> data manipulation language, and replaces it with hyd_uniq().  Here are
> some examples:
>
> amend:  u= uniq( timetags.bin_start, s )
> to:     u= hyd_uniq( timetags.bin_start, s )
>
>                 s/\(uniq\(/\(hyd_uniq\(/;
>                 s/(\W)uniq\(/$1hyd_uniq\(/;

I think you'r doing too much here.  I gather that your are catching those
parens to ensure that you replace only uniq as a whole word.  Thee is a
better way, using zero-width assertions to test for conditions without
actually capturing any characters.  Test for a word boundary with \b.  You
won't have to replace it then:

s/\buniq\b/hyd_uniq/

Should do the same, without as much "static".

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to