What is the URL pattern that is being used with the HTML5 element input type="url". I tried some regex from various forums but felt HTML5 url element is having a different pattern of regex. Can someone crack the regex for it? Thanks.
            Asked
            
        
        
            Active
            
        
            Viewed 1,986 times
        
    0
            
            
        - 
                    1I'm guessing it's an RFC 3987 compliant regular expression, something like [***this***](http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url#answer-190405) – adeneo Oct 09 '15 at 07:04
- 
                    Can you suggest me an equivalent regex for input type="url" ? Thanks – Vicky Oct 12 '15 at 08:04
- 
                    Possible duplicate of [What regular expression does a browsers use for HTML5 input type=url?](https://stackoverflow.com/questions/10626293/what-regular-expression-does-a-browsers-use-for-html5-input-type-url) – Theodore Brown Aug 28 '17 at 03:04
1 Answers
0
            
            
        I somehow managed to get an equivalent regex for type="url" element.
/^(ftp|http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]+)|((25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9]?)(\.(25[0-5]|2[0-4][0-9]|[1][0-9][0-9]|[1-9][0-9]|[0-9]?)){3}(:?[0-9]*)))?(\/.*)?$/ix
 
    
    
        Vicky
        
- 151
- 1
- 10