sdDirtySox wrote:
Hi all,

Hello,

I want to use a perl script that will look at all the files in a
directory to find an instance of a function and replace it with
another. I have the code in place to look at all the files in a
directory and to search line by line, but I'm having problems with the
regex to use.

Example:

sprintf(str, "hello");

replaced with:

sprintf_s(str, sizeof(str), "hello");

This may work but it is UNTESTED:

s/sprintf\(\s*(\w+),\s*(".*?")\s*\);/sprintf($1, sizeof($1), $2);/




John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to