Inbound action regex condition

JMHSN
Tera Contributor

I created an email inbound action to respond to customers who ask for a Distribution list or a DL with a link. 

I want the inbound action to catch DL in the subject line but not the word MIDDLE for example, so I added a regex condition, (\s{0,3}DL\s{0,3}).

 

This works fine to weed out MIDDLE and catch DL but if I have a space before or after DL "I need a DL created", it doesn't catch it. Does anyone have any ideas? I'm not a developer so I'm looking for a simple solution as I will be creating many of these inbound actions. 

 

Thanks

1 ACCEPTED SOLUTION

Hi, to combine 2 conditions you would use AND && or OR ||

So something like for the OR version

email.subject.toLowerCase().indexOf(' dl ') > -1 || email.subject.toLowerCase().indexOf('distribution list') > -1

 

View solution in original post

7 REPLIES 7

Tony Chatfield1
Kilo Patron

Hi, first step would be to identify all the valid formats that you need to capture.

The simplest solution would be to match ' DL ' only and not 'DL',
otherwise you will need exact scenarios\syntax that is valid.

Perhaps when DL is prefixed and\or suffixed by non alphabet characters? 

Should it always be in CAP's?
Once you have clear details of requirements then a solution will be much easier.

Thanks for responding. I'm a little confused about what you're asking. I want an inbound action that will action when subject contain <space>DL<space>. upper or lower case. I however don't want it to action on a word with DL in it (like MIDDLE). 

"I need a new dl created"

"Pleas add a DL with name All-Sales"

 

I have tried regex, "matches pattern", and contains. You mention ' DL ', which I tried but did not work. 

What would the actual condition look like? "Subject/matches patter/' DL ' for example?

Sounds like you will need ' DL ' IE <space>DL<space>

I see no need for regex as you can use a simple indexOf() and a condition like this should work

email.subject.toLowerCase().indexOf(' dl ') > -1

 I assume this is email.subject, if not just update to email.body_text

That's great Tony. That did it. As I mentioned I'm not a developer and new to inbound actions, so maybe you could help with one more piece. I also need to look for other words/terms. I was doing it through subject matches pattern this term or subject contains that word. Now using the condition you sent, I can't figure out how to do that. Can you give me the condition for what you sent plus "Distribution list". 

I'm basically looking to find anything with subject contains "Distribution list" or <space>DL<space>. 

JMHSN_0-1673393963625.png

Thanks so much!