
2ayev (2ayev) asked a question.
Is there a regular expression that enforces/validates an email to the Okta email naming rules..i.e. those expressed here:
https://help.okta.com/en/prod/Content/Topics/Directory/Reference_Directories.htm*targetText=Email%20top%2Dlevel%20domains%20(the,user%20names%20or%20email%20addresses.
Thanksinadvance
Scott

I put together a regex below that is based off of a combination of RFC5322 + Okta documentation, excluding the characters: ' ` ~. Regex is never perfect with email validation, and my example will not cover every possibility, but it should help accomplish your goal. This is written to conform to JavaScript regex rules so if you need it in another language just let me know!
(?:[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])+)\])