E-Mail Regex in Microflow?

2
I was wondering if I can add a Regular Expression for an E-Mail into a Microflow somehow? Because by using isMatch I get errors because there is “no viable alternative at input ‘?’”. This shows up at the first question mark of the Expression in the screenshot below. I know I can just set the Text Box where I have to enter this E-Mail to the Email Validation but then I get this one error message before I get all other error messages so I was wondering if I can add it to the Microflow somehow so it shows up at the same time with all other Error messages that show up if a Validation was not correct? It just looks better and more satisfying this way.
asked
3 answers
4

It is possible, you can create a string variable and put your RegEx in it, then use isMatch function to validate your email against it. See image

 

***** EDIT *****

 

try this Regex

 

'(?:[a-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])'

answered
2

I tried copying the Regular Expression in the String Variable as it was and then I tried wrapping it with “ “ and then I tried wrapping it with ‘ ‘ but each time I get an Error Message.

 

This is the Regular Expression in Text Form: (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

 

answered
0

If you want a less restrictive email address validator regular expression, then there is one available as part of the Community Commons module (that nearly every Mendix project will have already) in the Regexes folder called EmailAddressRegex.

answered