c# - Regex To Validate An Absolute Url -
i trying build regex validate following absolute url, here "/abc" , "/abc.exe" should valid else should invalid.
valid
- www.example.com/abc
- www.example.com/abc.exe
invalid
- www.example.com
- www.examplec.com/bbb
- www.examplec.com/bbb.exe
- all others other above two.
being new regex trying site - http://www.regexr.com/ build one. please advice.
the following regex want. can make more general cover wider range of possibilities:
^www\.example\.com\/abc(\.exe)?$
demo: http://regex101.com/r/tf0wa8
for more generic regex, need like:
^w{3}\.[^.]+\.(com|net|org|gov|edu)\/[^.]+(\.exe)?$
Comments
Post a Comment