Regular Expression
Regular Expression
- Website Regex
- regex: ^((https?|ftp|smtp):\/\/)?(www.)?([a-zA-Z0-9]{2,})+\.[a-zA-Z0-9]+(\.[a-zA-Z0-9]*)?(\/[a-zA-Z0-9#]+\/?)*$
- Supported format
- https://themadhurgupta.blogspot.com
- https://themadhurgupta.blogspot
- https://themadhurgupta.blogspot.com/#madhur
- aa.com
- themadhurgupta.blogspot
- themadhurgupta.blogspot.com
- https://www.themadhurgupta.blogspot.com
- Here:
^ Should start with
((https?|ftp|smtp)://)? may or may not contain any of these protocols
(www.)? may or may not have www.
[a-z0-9]+(.[a-z]+) url and domain and also subdomain if any upto 2 levels
(/[a-zA-Z0-9#]+/?)*/? can contain path to files but not necessary. last may contain a /
$ should end there
- If you want to try to go on https://regex101.com/r/WUp6VL/1
- For a review of Regex Visit
Comments
Post a Comment