Skip to content

Commit

Permalink
fix(internal): Fix URL pattern to match local
Browse files Browse the repository at this point in the history
  • Loading branch information
cahilfoley authored Oct 19, 2018
1 parent ba9041e commit 0c2a363
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/internal/patterns/validURL.ts
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

0 comments on commit 0c2a363

Please # to comment.