Skip to main content
Best answer

Trouble with Regex code

  • February 28, 2023
  • 3 replies
  • 231 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 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

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

3 replies

nicksimard
Forum|alt.badge.img+11
  • Zapier Staff
  • 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
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • 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:

 


jojo69
  • Author
  • Beginner
  • February 28, 2023

Thanks @nicksimard, that did the trick!

 

Cheers