Regex to replace Class:GetClass('foo') with get-clas

Posted by Peter Judge on 30-Jul-2014 13:42

If you want to replace your existing weakly-typed GetClass() calls with the new, strongly-typed get-class keyword, you can do so via regex in PDSOE.

Using Search (CTRL-H), select the 'Regular Expression' checkbox.

Paste the following into the 'Containing Text' field

Class:GetClass\(['"](.*)['"]\)

Select Replace.

In the 'With' field in the following dialog, paste

get-class(\1)

You can choose Preview or OK to apply the action. Note that this regex will not work well with Progress.Lang.Class:GetClass('foo'), so you might first want to replace

Progress.Lang.Class:GetClass\(['"](.*)['"]\) with get-class(\1) and then the unqualified version.

hth,

-- peter

All Replies

Posted by Mike Fechner on 30-Jul-2014 13:45

Hi Peter,
 
that’s very, very useful information!
 
Mike
[collapse]
From: Peter Judge [mailto:bounce-pjudge@community.progress.com]
Sent: Mittwoch, 30. Juli 2014 20:43
To: Beta.OE11.4@community.progress.com
Subject: [Beta - OE11.4] Regex to replace Class:GetClass('foo') with get-class(foo)
 
Thread created by Peter Judge

If you want to replace your existing weakly-typed GetClass() calls with the new, strongly-typed get-class keyword, you can do so via regex in PDSOE.

Using Search (CTRL-H), select the 'Regular Expression' checkbox.

Paste the following into the 'Containing Text' field

Class:GetClass\(['"](.*)['"]\)

Select Replace.

Class:GetClass\(['"](.*)['"]\)

In the 'With' field in the following dialog, paste

get-class(\1)

You can choose Preview or OK to apply the action. Note that this regex will not work well with Progress.Lang.Class:GetClass('foo'), so you might first want to replace

Progress.Lang.Class:GetClass\(['"](.*)['"]\) with get-class(\1) and then the unqualified version.

hth,

-- peter

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

This thread is closed