Validation rules Regex not working

0
Hej guys! I just started my Mendix journey and I'm working on the learning paths to get the hang of it :) In the learning path Become a Rapid Developer (Developer) I followed all the steps to add a regular expression to my email attribute. I have used the standard Regex code (see below) for a good e-mail adress but I keep getting the error that my e-mail adress isn't valid.  I something wrong with the Regix code or is this beceause the learning path is quite old (and now you have to do it in a different way?) Thanks for helping this newby!    p.s. Regex code I used:  (?:[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])+)\])
asked
3 answers
1

This course you mean: https://gettingstarted.mendixcloud.com/link/module/95/lecture/766/8.3.1-Add-Regular-Expressions

The regex you are using is the General Email Regex (RFC 5322 Official Standard) taken from http://emailregex.com/.

Regular expressions are often quickly confusing. When working with any non-trivial regex, you best develop it using freeformatter.com. Once you are happy with the result, save it on your account on the same site for your own future reference. Also, add unit tests to it. You will very likely still get some unexpected results. Modify your regex to match every last possible value of your application’s use-cases.

Only then copy it to your Mendix app. Make sure you document it well and that you copy the unit tests to your app as well.

But getting back to your question: where do you go wrong? The regex in your forumpost is fine. So the question is, what have you not done according to the course?

 

 

answered
0

I had the same issue.  I edited the ‘MyFirstModule.Email’ regular expression and noticed there was an extra EOL (End of Line) character at the very end.  I deleted that EOL character, clicked ‘OK’, and it worked for me!

 

answered
0

On the way Become a Fast Developer, the same problem occurred to me. I was able to solve with the help of the friend who freeformatter.com and there I got the following expression that solved the problem:

^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$
answered