Avatar of usamike1
usamike1
 asked on

use regular expression to find data and so it can be marked for redaction

Data to be found and marked for redaction looks like this:

I50name initial. name, 0000

or
I50mr. name name, jr., 1111

data to be marked should be the last 4 digits

every line will end with 4 digits

i am having trouble trying to account for data that may or may not be in all lines that i am trying to find that start with I50 and end with 4 digits
Regular Expressions

Avatar of undefined
Last Comment
usamike1

8/22/2022 - Mon
Russ Suter

^I50.*\d{4}$

Open in new window

The above Regex breaks down as follows:

^ = start from the beginning of the string
I50 = look for exactly this string pattern
.* = look for any character, any number of times
\d{4} = look for exactly 4 numeric digits
$ = end of the string

Basically this will match any string that starts with "I50" and ends with 4 numeric digits.

Consider using Expresso for Regex stuff. It's free but you have to register. I use it all the time and it makes life so much easier.

http://www.ultrapico.com/expresso.htm
ASKER CERTIFIED SOLUTION
usamike1

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Russ Suter

If you have your solution could you please close out this question?
usamike1

ASKER
Solution to my problem resolved. Thank you.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Russ Suter

OK, then close the question please.
usamike1

ASKER
my question has been answered. thank you.