Skip to main content
Best answer

Trouble with Regex code

  • February 28, 2023
  • 3 replies
  • 184 views

jojo69

Hey guys,

I’m struggling with the Regex code in a formatter Zap. I’m trying to extract the “Name” attribute from the following string, but my regex code doesn’t seem to work in Zapier, as I keep getting an empty result.

 

“Name: Tester E-mail: Tester@gmail-email-com.com


This is my formula:

/(?<=Name: )(.*)(?= E-mail:)/g

 

Can anybody spot my error?

 

Help would be much appreciated!

Best answer by nicksimardBest answer by nicksimard

Hi @jojo69!

So in the text you showed, are you only interested in getting the word “Tester”? And will the data always come in that same format?

If so, this should work for you (I used Chat GPT to get the answer because RegEx eludes me, no matter how hard I try haha):

(?<=Name: )\b\w+\b

View original
Did this topic help you find an answer to your question?

3 replies

nicksimard
Forum|alt.badge.img+11
  • Zapier Staff
  • 2115 replies
  • Answer
  • February 28, 2023

Hi @jojo69!

So in the text you showed, are you only interested in getting the word “Tester”? And will the data always come in that same format?

If so, this should work for you (I used Chat GPT to get the answer because RegEx eludes me, no matter how hard I try haha):

(?<=Name: )\b\w+\b


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 31122 replies
  • February 28, 2023

Hi @jojo69 

Good question.

Some other options:

  1. You can use multiple Formatter > Text > Split steps to isolate the desired value.
  2. You can use OpenAI > Send Prompt to have AI isolate the desired value.
  3. You can use a Code step:

https://community.zapier.com/featured-articles-65/how-to-parse-data-with-javascript-code-step-using-split-14133

 


jojo69
  • Author
  • Beginner
  • 1 reply
  • February 28, 2023

Thanks @nicksimard, that did the trick!

 

Cheers


Reply