fix URL parsing edge cases (#360)

This should fix the following:
- URLs in parentheses
- URLs at the end of a sentence
This commit is contained in:
Sam Samskies
2023-02-27 09:21:38 -10:00
committed by GitHub
parent f934dcd092
commit 2782f24690
4 changed files with 50 additions and 10 deletions

View File

@ -84,13 +84,6 @@ export const EmailRegex =
// eslint-disable-next-line no-useless-escape
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
/**
* Generic URL regex
*/
export const UrlRegex =
// eslint-disable-next-line no-useless-escape
/((?:http|ftp|https):\/\/(?:[\w+?\.\w+])+(?:[a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?)/i;
/**
* Extract file extensions regex
*/