Page 1 of 1

Use regular expressions in replace?

Posted: Thu Apr 22, 2010 9:06 am
by hibiscus
I need to transform some hundreds of thousands of lines of program code. A solution to the following problem would be a big start:

This
procedure showmessage(mess as string,mheight as long)
if vartype(.....

needs to become this

function showmessage(mess as stringt,mheight as long)
{
if vartype(....

Where everything varies except "procedure" in the search block, and "function" and brace in the replace block.

Gleason

Re: Use regular expressions in replace?

Posted: Thu Apr 22, 2010 11:10 am
by DataMystic Support
Find perl pattern:

Code: Select all

procedure (\w+)\((\w+) as string,(\w+) as long\)
if vartype\(
replace with:

Code: Select all

function $1($2 as string,$3 as long)
{
if vartype(....

Re: Use regular expressions in replace?

Posted: Thu Apr 22, 2010 11:37 am
by hibiscus
DataMystic Support wrote:Find perl pattern:

Code: Select all

procedure (\w+)\((\w+) as string,(\w+) as long\)
if vartype\(
replace with:

Code: Select all

function $1($2 as string,$3 as long)
{
if vartype(....
Close enough that I can make it work. Thanks.