javascript - regular expression for wildcard domain validation -
I am new to writing regular expressions I am planning to write regular expressions to validate wildcard domain mailing . Here are the scenarios.
Correct:
-
*. Test.comtest.comabc.test.comWrong:
-
* Test Comtest.com *test. Comtest.abc * .comMy regular expression for the above secnario
[One-zA-Z0-9]) \ [+ A-zA-Z] {2,6} $ /Is it working as expected? Do we have better expressions Can improve or write?
^ (\ *.)? ([\ W -] + \.) + [\ W -] + $matches your examples.
From my point of view, I also consider the third negative example correct.
^ (([\ w -] + \.) | (\ *.)) + [\ W -] + $< / P>
Edit:
You may have to customize the character squares to include the allowed characters. I wanted to keep Rizax easy to read
Comments
Post a Comment