mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-28 09:46:39 +02:00
Update regex
This commit is contained in:
parent
ebb541dc6b
commit
a67f0909ef
1 changed files with 8 additions and 3 deletions
|
@ -5,9 +5,14 @@
|
|||
*/
|
||||
export function isValidName(value: string) {
|
||||
// Check for URL patterns
|
||||
const urlPattern =
|
||||
/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/i;
|
||||
if (urlPattern.test(value)) {
|
||||
// First check for common prefixes to avoid false positives with names like "Dr. Smith"
|
||||
if (/(https?:\/\/|www\.|http:|https:)/.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common TLDs that would indicate a URL
|
||||
const commonTLDs = /\.(com|org|net|edu|gov|io|co|me|app|dev|info)(\s|$|\/)/i;
|
||||
if (commonTLDs.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue