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

usamike1
usamike1 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Russ SuterSenior Software Developer

Commented:
^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
Commented:
Yes, I received a solution to my question.

Thank you,

Mike Maher
Russ SuterSenior Software Developer

Commented:
If you have your solution could you please close out this question?
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Author

Commented:
Solution to my problem resolved. Thank you.
Russ SuterSenior Software Developer

Commented:
OK, then close the question please.

Author

Commented:
my question has been answered. thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial