Best answer

How to Extract City in a Field with Punctuations, Numbers & Letters

  • 13 April 2020
  • 6 replies
  • 301 views

Userlevel 1

I am looking up posts about extract pattern to find help for my problem. 

 

I’m trying to extract the city name in a field. The field has punctuations and often times has Zip codes and other times the State. Here are some examples of the field. 

 

Denver. 80211

Denver CO CO

Aurora, 

Littleton, CO CO

Denver 80128

Littleton CO. 80411

 

How do i grab the first city only? Im thinking of removing the numbers and punctuations, but don’t know how. Thanks

icon

Best answer by JMoore 20 April 2020, 20:03

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +11

Hi Jeff,

That could be tricky to do, especially since cities can consist of multiple words and might also include periods. Example: St. Augustine, FL.

Is there any way to clean the data up before it gets into the Zap? How is it getting to Zapier? Is it a form submission, an email parser, etc? Can you elaborate a bit on what the overall process looks like?

Userlevel 7
Badge +8

Hi @JMoore ,

Circling back to see if you were all set or had additional questions on how to possibly extract the city name from your field. I have also merged your posts so any responses/replies can be documented in one thread :relaxed:

Please let us know if you have any questions- happy to help!

Userlevel 1

Yes thank you Liz and Nick. I went ahead and figured out how to do some coding and used a “extract pattern” step to extract only words containing letters. Which is what i needed to do. Tested it a few times with different names and its been working. if anyone is interested in that code, i can post it. 


Thanks

Userlevel 7
Badge +8

@JMoore that’s great! If you’re comfortable sharing the code, I’m sure other users would love to see how you did it.

Thanks for letting us know!!

Userlevel 1

 

Userlevel 7
Badge +11

That’s awesome @JMoore! Extract Pattern is super powerful but super easy to get incorrect, since it has to be set up very precisely in order to work. Thanks so much for sharing that :)