changed url regex to a stricter one

This commit is contained in:
Hazel Noack
2025-07-11 15:14:51 +02:00
parent 45111321b2
commit 15df8b69f5
2 changed files with 1 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ const form = document.getElementById("search-form");
const input = document.getElementById("search-input");
// https://stackoverflow.com/a/3809435/16804841
const expression = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;
const expression = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi;
const urlRegex = new RegExp(expression);
const searchEngines = {