Link to home
Start Free TrialLog in
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
Avatar of Russ Suter
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
Avatar of usamike1
usamike1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you have your solution could you please close out this question?
Avatar of usamike1

ASKER

Solution to my problem resolved. Thank you.
OK, then close the question please.
my question has been answered. thank you.