-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(internal): Fix URL pattern to match local
- Loading branch information
1 parent
ba9041e
commit 0c2a363
Showing
1 changed file
with
2 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
/** Regular expression to match URL patterns, developed using this handy tool https://regexr.com/3sju0 */ | ||
const urlRegex: RegExp = new RegExp( | ||
[ | ||
'^(https?:\\/\\/)', // Protocol | ||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((d{1,3}.){3}d{1,3}))', // Host name or IP | ||
'(\\:\\d+)?', // Optional port | ||
'(\\/[-a-z\\d%_.~+]*)*', // Path | ||
'(\\?[;&a-z\\d%_.~+=-]*)?', // Optional query string | ||
'(\\#[-a-z\\d_]*)?$' // Optional anchor hash | ||
].join(''), | ||
'i' | ||
) | ||
/** Regular expression to match URL patterns, developed using this handy tool https://regex101.com/r/lQ1nI3/1 */ | ||
const urlRegex: RegExp = /^(http[s]?:\/\/)?([^:\/\s]+)(:([^\/]*))?(\/\w+\.)*([^#?\s]+)(\?([^#]*))?(#(.*))?$/i | ||
|
||
export default urlRegex |