I’m having trouble with a regex pattern in Zapier. I want to grab text that comes after a certain word in an email from Gmail. Here’s what I’m trying:
(?<=Lic: )[^.\s]*
This works fine when I test it on regex101.com, but Zapier doesn’t seem to like it. I’ve tried adjusting the pattern, but no luck so far. Has anyone run into this before? Maybe Zapier handles regex differently?
I’m not sure if I’m missing something obvious or if there’s a Zapier-specific way to do this. Any tips or tricks would be really helpful. Thanks!
I’ve encountered similar challenges with Zapier’s regex support. In my experience, a workaround that often works is using a combination of the ‘Find Text’ and ‘Extract Pattern’ utilities in Zapier. For your specific case, you could try a two-step approach:
- Use ‘Find Text’ to locate ‘Lic:’ in your email content.
- Then use ‘Extract Pattern’ with something like
(\S+) to capture the first word after ‘Lic:’.
This method has proven more reliable for me than complex regex patterns in Zapier. If you need to capture multiple words or deal with varied formats, you might need to adjust the pattern or use multiple steps. Remember, Zapier’s regex engine can be quite particular, so sometimes simpler patterns work better.
have u tried using a positive lookahead instead? something like this might work:
Lic:\s*(?=(\S+))
zapier can be finicky with regex, but this pattern should grab the text after ‘Lic:’ without using lookbehinds. if that doesnt work, maybe try breaking it into multiple steps like others suggested
I’ve run into similar issues with Zapier’s regex implementation before. From my experience, Zapier doesn’t support lookbehinds, which is likely why your pattern isn’t working there despite working on regex101.
Instead, try using a capturing group approach. Something like this might work better:
Lic:\s*([^.\s]*)
This pattern looks for ‘Lic:’, followed by any whitespace, then captures everything up to the next space or period. You’d then use the first captured group as your output in Zapier.
If that doesn’t work, you might need to use Zapier’s Code step instead. It gives you more flexibility with JavaScript, where you can use more complex string manipulation if regex isn’t cutting it.
Hope this helps! Let me know if you need any clarification on implementing this approach.