Have a set of addresses I am trying to parse out and am having some difficulties because there are varying number of words and digits I am looking for. Some addresses even have other names before them so I was wondering if anyone who knows Regex better than I could tell me if there was a way to elimate all words that come before a set of digits from {1,4}.
For example some addresses say: "ABC Company 1234 MAIN ST" and I would like eliminate that in a way that would work with differnt company names and address #'s
Appreciate the help!
Solved! Go to Solution.
Hi @pmckenn
I have attached a workflow using regex which seperates the company name, digits and street address.
I was no sure what you meant by eliminate so seperating these into three fields can give you oppourtunity to remove the field you dont want and concatenate the fields using a formula tool.
Hopefully this helps you out!
Best,
Jordan Barker
Solutions Consultant
Hi,
This expression "([A-Z a-z]+)(\<\d.*\>)" will eliminate your adress given "ABC Company 1234 MAIN ST" as "ABC Company" and "1234 MAIN ST".
Regards
Vishwa
Only a slight edit to the formula and some context:
I assume that you are going to create two (2) fields: Business Name & Business Address.
regex_replace([Field],"([[:alpha:]]+)\s(\<\d.*\>)","$1")
That formula will give you Business Name & will eliminate the trailing space. The $1 gets you the first grouping. You can alter the formula for the Business Address field by replacing $1 with $2.
is there a way to do that with any # of digits? I should have been more clear that not every address starts with 4 digits. That expression takes any 4 digits number which sometimes would fall to the last 4 in a digit Zip code like "12345-1234" is there a way to parse any number of words before any set of digits from 1-4?
([A-Z a-z]+)(\d*) This expression should give you everything before any sets of digits 1-4
Best,
Jordan Barker
Solutions Consultant
That just pulls out the number and combines the rest. Any way to turn "ABC Company Inc. 123 N. Main St. New York, NY 12345" into "ABC Comany Inc" and "123 N Main etc" ?
Hi @pmckenn,
Looks like it needed a slight modification to account for punctuation before the Street Number and to pull through the rest of the address following the Street Number: ([A-Z a-z]+\W*)(\d*.*)
Attached is a sample workflow with a few addresses to test.
Cheers,