Skip to content

Commit

Permalink
fix(internal): Fix validURL regex pattern
Browse files Browse the repository at this point in the history
The pattern was missing backslash escapes for the digit patterns
in IP addresses or local hostnames
  • Loading branch information
cahilfoley committed Oct 19, 2018
1 parent 153fce6 commit ddb79cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internal/patterns/validURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const urlRegex: RegExp = new RegExp(
[
'^(https?:\\/\\/)', // Protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}', // Internet routable host
'|(([a-zd]([a-zd-]*[a-zd])*))', // Host on same domain
'|((d{1,3}.){3}d{1,3}))', // IP address
'|([a-z\\d]([a-z\\d-]*[a-z\\d])*)', // Host on same domain
'|(\\d{1,3}\\.){3}\\d{1,3})', // IP address
'(\\:\\d+)?', // Optional port
'(\\/[-a-z\\d%_.~+]*)*', // Path
'(\\?[;&a-z\\d%_.~+=-]*)?', // Optional query string
Expand Down

0 comments on commit ddb79cb

Please # to comment.