Skip to content

Commit

Permalink
Use a more sane regexp pattern without capture groups for URL matching (
Browse files Browse the repository at this point in the history
  • Loading branch information
jannfis authored Feb 26, 2020
1 parent 6592773 commit 990d9ef
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import {ComparisonStatusIcon, HealthStatusIcon, syncStatusMessage} from '../util
require('./application-summary.scss');

const urlPattern = new RegExp(
'^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))' + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$',
'i'
`^(https?://(?:www\.|(?!www))[a-z0-9][a-z0-9-]+[a-z0-9]\.[^\s]{2,}|www\.[a-z0-9][a-z0-9-]+[a-z0-9]\.` +
`[^\s]{2,}|https?://(?:www\.|(?!www))[a-z0-9]+\.[^\s]{2,}|www\.[a-z0-9]+\.[^\s]{2,})$`,
'gi'
);

function swap(array: any[], a: number, b: number) {
Expand Down

0 comments on commit 990d9ef

Please sign in to comment.