03-13-2017 06:35 AM
Hello,
we are trying to create a filter to match for Links where the address mail domain is included.
something like https://example.com/u/id?=daniel@mydomain.com
due to the amount of domains we use I would like to include the domain list with a dictionary, but it seems that the body-dictionary-match does not like regex.
I was currently testing with the follwing string (which obviously does not work), but maybe you guys can correct me there.
body-dictionary-match("(?i)http.+\\@('domain_list'))
match "http" + any character till "@" then include the names in the dictionary
I could use body-contains("(?i)http.+\\@(Test1|Test2|Test3)\\..."), but as I said we use many domains and I want it to be modular if we add a new domain.
I do not know if what I want to accomplish is even possible with that command, but maybe you guys know more.
thanks
br
Daniel
Solved! Go to Solution.
03-13-2017 07:28 AM
Hi Daniel,
You could try using the dictionary directly in the condition such as below.
body-dictionary-match("domain_list", 1)
Then configure the dictionary with the required regex.
http.+\\@Test1
http.+\\@Test2
http.+\\@Test3
.
.
.
etc
The only other way would be to use two conditions, however this would not be accurate matching a single line.
body-contains("(?i)http.+\\@")
AND
body-dictionary-match("domain_list", 1)
Would need testing to see what works best for you.
Thank You!
Libin Varghese
03-13-2017 07:28 AM
Hi Daniel,
You could try using the dictionary directly in the condition such as below.
body-dictionary-match("domain_list", 1)
Then configure the dictionary with the required regex.
http.+\\@Test1
http.+\\@Test2
http.+\\@Test3
.
.
.
etc
The only other way would be to use two conditions, however this would not be accurate matching a single line.
body-contains("(?i)http.+\\@")
AND
body-dictionary-match("domain_list", 1)
Would need testing to see what works best for you.
Thank You!
Libin Varghese
03-14-2017 01:58 AM
Hello Libin,
thanks for the update, thats exactly what i want to accomplish.
just a heads up - if you are using regex in a dictionary you do not need the double backslashes.
here is the note from the user guide describing the backslash rule:
Important Note: The backslash is also a special escape character for the parser. As a result, if you want to include backslash in your regular expression, you must use two backslashes — so that after parsing, only one “real” backslash remains, which is then passed to the regular expression system. So, if you wanted to match the example domain above, you would enter ^ik\\.ac\\.uk$.
regards
Daniel
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide