Simple Search and Replace use of Regular Expression

Posted by nunos on Stack Overflow See other posts from Stack Overflow or by nunos
Published on 2010-05-10T19:32:53Z Indexed on 2010/05/10 19:44 UTC
Read the original article Hit count: 151

Filed under:

So, I am adapting some code I found online to suit my needs. However, my set_pixel function has two more parameters. Since there are lots of calls to this function even doing a quick paste over would be very tedious. So, I thought this would be a good time for me to learn some simple regular expressions.

So, I have calls of this type:

set_pixel(arg1, arg2);

which I want to change to something like:

set_pixel(arg1, arg2, arg3, arg4);

Note: arg1 and and 2 should be preserved, whereas arg3 and arg4 are most of the time the same.

How can I achieve this?

© Stack Overflow or respective owner

Related posts about regex