Archived Read Only Forums > SlickEdit® Core for Eclipse

Question about find and replace with regular expression

(1/1)

kenbr1960:
I am trying to do a find/replace using this unix regular expression search.

Y...." TO READ-VAR2

The search works fine but the problem is the '....' will match any pattern but in my replace I want to change the 'Y' to an 'N' but leave the other characters alone and I can't figure out if there is a way to this. As an example I have these two lines:

MOVE "1200Y0000000YSTX1" TO READ-VAR2.
MOVE "1200Y0000000YDEF " TO READ-VAR2.

I would liked to do a find/replace in files that would find and change these two lines to this

MOVE "1200Y0000000NSTX1" TO READ-VAR2.
MOVE "1200Y0000000NDEF " TO READ-VAR2.

If I do a search in files I'm finding around 80 lines throughout the files that I need to change. I'm just wondering if anyone knows of a way to do this.

hs2:
use tagged groups
e.g.

--- Code: ---search:  Y([A-Z].+)(" TO READ-VAR2)
replace: N\1\2
--- End code ---
HS2

kenbr1960:
Thanks!

Navigation

[0] Message Index

Go to full version