It seems to me this should match just fine. Can someone point out to me what I'm doing wrong?
Regular Expression:
^.* ATM DEPOSIT (?'Month'\d{2})-(?'Day'\d{2}) #(?'Reference'[0-9A-Za-z]) .*$
String:
BKOFAMERICA ATM DEPOSIT 07-05 #006475 CUSTOMER 2323 BANK OF AMERICA, SAVANNAH, GA
You are missing a +.
Your expression.
^.* ATM DEPOSIT (?'Month'\d{2})-(?'Day'\d{2}) #(?'Reference'[0-9A-Za-z]) .*$
Correct expression.
^.* ATM DEPOSIT (?'Month'\d{2})-(?'Day'\d{2}) #(?'Reference'[0-9A-Za-z]+) .*$
Apart from that, since you're not interested in anything before the date and after the reference, there is no need to match it. Use:
ATM DEPOSIT (?'Month'\d{2})-(?'Day'\d{2}) #(?'Reference'[0-9A-Za-z]+)
You forgot the + at the end of the submatch. It should look like this
(?'Reference'[0-9A-Za-z]+)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With