Replacing with Regular Expressions

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Miguel

Replacing with Regular Expressions

Post by Miguel »

How can I use textpad to replace the string:

AB

with the following string:

XAYBZ

where A, and B are two RE's and X, Y, Z are literal strings?
For example:
A: [a-z]*y
B: [a-z]*z
X: start
Y: middle
Z: finish
N. Demos

Re: Replacing with Regular Expressions

Post by N. Demos »

A: [a-z]*y
B: [a-z]*z
X: start
Y: middle
Z: finish

Find String: \([a-z]*y\)\([a-z]*z\)
Replace String: start\1middle\2finish

More Generally (for the same situation above):
Find String: \(A\)\(B\)
Replace String: X\1Y\2Z
Miguel

Re: Replacing with Regular Expressions

Post by Miguel »

Thanks a lot!
Post Reply