How to write a Regular expression for the following:

General discussions about Advanced Find and Replace
Post Reply
pelletic
Posts: 4
Joined: Mon Jan 31, 2005 5:32 pm

How to write a Regular expression for the following:

Post by pelletic »

locate a string like

Input:

Screen MAS001.PROG ACTION FIND

and replace it with $PROG\MAS001

Output
Screen $PROG\MAS001 ACTION FIND

The part that changes is MAS001
Charles

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hi,

I tested and the following works:

Search for:
Screen (.*)\.PROG ACTION FIND

Replace with:
Screen $PROG\\$1 ACTION FIND

I hope you have got an idea: you should use variables $1 and chars escaping.

Read again:
http://www.abacre.com/afr/manual/regexpsyntax.htm

Post Reply