Checking URL Patterns
Category: JavaScript
Usage
Explanation
URLPattern
makes it way easier to test whether a string modeling a URL conforms to a pattern. Additionally, a URLPattern
is specifically designed to test URLs, so you don’t have to deal with regular expressions only to find out whether URLs are correct (pattern-wise).
The API is experimental, though. The following browsers have support for URLPattern
:
- Chrome
- Edge
- Opera
- Chrome Android
- Opera Android
- Samsung Internet
- WebView Android
The following browsers have no support for URLPattern
:
- Firefox
- Safari
- Firefox Android
- Safari iOS