Skip to content

Commit

Permalink
fix: non backtracking regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Feb 8, 2025
1 parent b06d550 commit 47cb4e9
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,14 @@ const widgetValidation = {
url: {
isValidURL: (urlValue, urlObj, intlFunc) => {
var urlRegex = new RegExp(
'^(https?:\\/\\/)?' + // validate protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name
'((\\d{1,3}\\.){3}\\d{1,3}))|' + // validate OR ip (v4) address
'(localhost)' + // validate OR localhost address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path
'^(https?:\\/\\/)?' + // optional protocol
'(' +
'([a-z\\d]+(-[a-z\\d]+)*\\.)+[a-z]{2,}|' + // validate domain name
'((\\d{1,3}\\.){3}\\d{1,3}))|' + // OR ip (v4) address
'(localhost)' + // OR localhost
')' +
'(\\:\\d+)?' + // optional port
'(\\/[-a-z\\d%_.~+]*)*' + // path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string
'(\\#[-a-z\\d_]*)?$', // validate fragment locator
'i',
Expand Down

0 comments on commit 47cb4e9

Please sign in to comment.