diff --git a/src/libs/Url.ts b/src/libs/Url.ts index 4e3282e7bdb3..80ca98c712cf 100644 --- a/src/libs/Url.ts +++ b/src/libs/Url.ts @@ -56,4 +56,10 @@ function appendParam(url: string, paramName: string, paramValue: string) { return `${url}${separator}${paramName}=${paramValue}`; } -export {addTrailingForwardSlash, hasSameExpensifyOrigin, getPathFromURL, appendParam}; +function hasURL(text: string) { + const urlPattern = /((https|http)?:\/\/[^\s]+)/g; + + return urlPattern.test(text); +} + +export {addTrailingForwardSlash, hasSameExpensifyOrigin, getPathFromURL, appendParam, hasURL};