Hello,
I am pattern matching on an application we receive from outside folks. I was able to get the pattern to match if everything follows the first example below; however, we see that some folks put apartment information in with a comma like the second example causing issues. Is there a way to start from the end of the string instead of the front since the end is always the same? I'm new at regex, and any help is greatly appreciated.
Regex I'm using to parse the State:
ADDRESS:\(Street, City, State/Province, Zip/Postal Code\)\r(?:[^,]+,){2}\s(\w+)
Example 1:
ADDRESS:(Street, City, State/Province, Zip/Postal Code)
12345978 9th Ave NE, Everett, Washington 98204 
Example 2:
ADDRESS:(Street, City, State/Province, Zip/Postal Code)
12345978 9th Ave NE, Apt #403, Everett, Washington 98204 
Updating to show all data being parsed that is OCR'd when brought into Laserfiche.
EMPLOYMENT APPLICATION 
CITY OF MARYSVILLE
1049 State Avenue
Marysville, Washington 98270
http://marysvillewa.gov 
Smith, John Joe
00574 POLICE OFFICER - ENTRY LEVEL 
Received: 8/30/22 5:19
PM
For Official Use Only:
QUAL:_________
DNQ:__________
   Experience
   Training
   Other:______
PERSONAL INFORMATION
POSITION TITLE:
POLICE OFFICER - ENTRY LEVEL 
EXAM ID#:
00123
NAME:(Last, First, Middle)
Smith, John Joe
SOCIAL SECURITY NUMBER:
123-00-9789
ADDRESS:(Street, City, State/Province, Zip/Postal Code)
1234 56th Place Southwest, Apt# 123,  Lake Stevens, Washington 98258 
EMAIL ADDRESS:
john.smithtacos99@gmail.com
HOME PHONE:
13601234567
NOTIFICATION PREFERENCE:
Email
DRIVER'S LICENSE:
Yes No 
DRIVER'S LICENSE:
State:WA Number:WDLXXXXXXXXXB  
LEGAL RIGHT TO WORK IN THE UNITED STATES?
Yes No
What is your highest level of education?
Bachelor's Degree 
PREFERENCES
WHAT TYPE OF JOB ARE YOU LOOKING FOR?
Regular
TYPES OF WORK YOU WILL ACCEPT:
Full Time
SHIFTS YOU WILL ACCEPT:
Day,Evening,Night,Rotating,Weekends,On Call (as needed)
OBJECTIVE:
Find a new career.
EDUCATION
DATES:
From: 9/2019 To: 9/2021 
SCHOOL NAME:
Seattle University
LOCATION:(City, State/Province)
Seattle , Washington 
DID YOU GRADUATE?
Yes No 
DEGREE RECEIVED:
Bachelor's
MAJOR:
Taco Creation 
UNITS COMPLETED:
90 - Quarter
DATES:
From: 1/2019 To: 8/2019 
SCHOOL NAME:
Highline College
LOCATION:(City, State/Province)
Lake Stevens , Washington 
DID YOU GRADUATE?
Yes No 
DEGREE RECEIVED:
Associate's
MAJOR:
Taco Creation emphasis on burritos
UNITS COMPLETED:
45 - Quarter
DATES:
From: 4/2018 To: 12/2018 
SCHOOL NAME:
Renton Technical College
LOCATION:(City, State/Province)
Renton , Washington 
DID YOU GRADUATE?
Yes No 
DEGREE RECEIVED:
Associate's
MAJOR:
General 
UNITS COMPLETED:
55 - Quarter
DATES:
From: 4/2021 
SCHOOL NAME:
Seattle University
LOCATION:(City, State/Province)
Seattle , Washington 
DID YOU GRADUATE?
Yes No 
DEGREE RECEIVED:
Master's
MAJOR:
Criminal Justice
WORK EXPERIENCE
DATES:
From: 5/2017 To: 5/2018 
EMPLOYER:
Johns Best Tacos
POSITION TITLE:
Store Manager
ADDRESS:(Street, City, State/Province, Zip/Postal Code)
1234 Johns Taco Street, Suite #101,  Arlington, Washington, 98233
PHONE NUMBER:
360-123-4567 
SUPERVISOR:
Billy Joel Owner
MAY WE CONTACT THIS EMPLOYER?
Yes No
John Smith Person ID: 12345678 Received: 8/30/22 5:19 PM
Thank you,
Brandon