Use regular expressions in replace?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

Use regular expressions in replace?

Postby hibiscus » Thu Apr 22, 2010 9:06 am

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: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Use regular expressions in replace?

Postby DataMystic Support » Thu Apr 22, 2010 11:10 am

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(....
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: Use regular expressions in replace?

Postby hibiscus » Thu Apr 22, 2010 11:37 am

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.


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests