SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit® Core for Eclipse™ => Topic started by: kenbr1960 on June 22, 2014, 08:50:52 pm

Title: Question about find and replace with regular expression
Post by: kenbr1960 on June 22, 2014, 08:50:52 pm
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.

Title: Re: Question about find and replace with regular expression
Post by: hs2 on June 23, 2014, 07:25:37 am
use tagged groups
e.g.
Code: [Select]
search:  Y([A-Z].+)(" TO READ-VAR2)
replace: N\1\2
HS2
Title: Re: Question about find and replace with regular expression
Post by: kenbr1960 on June 26, 2014, 11:08:04 am
Thanks!