Tuesday, 15 January 2013

Regex to validate a url using a wildcard? -


Indicate that I have a list of valid domain roots,

example.com P> How can I validate to use a regex that my variable url is in the list, including subdomain?

For example, maybe my URL is "subdomain.case.example.com"

She has to explicitly say:

How do I use a regex to verify that my url *. Example.com or *. Test.com or example.com or test.com ?

something like that?

  ^ ((\ * | [\ w \ d] + (- [\ w \ d] +) *)).) * (Example | Exam) (\ .com) $   

regular expression image

To allow for such things ... subdomain * Example.com, subdomain.example.com, example.com, * .example.com, etc. L

No comments:

Post a Comment