Use regular expressions in replace?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
hibiscus
Posts: 2
Joined: Thu Apr 22, 2010 8:56 am

Use regular expressions in replace?

Post 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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Use regular expressions in replace?

Post 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(....
hibiscus
Posts: 2
Joined: Thu Apr 22, 2010 8:56 am

Re: Use regular expressions in replace?

Post 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.
Post Reply