Skip to content

Commit

Permalink
update regex email
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Jul 17, 2023
1 parent 1fff74f commit 62ffe11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const escapeScriptHtml = (str: string) => {
return str.replace(/<.*?script.*?>.*?<\/.*?script.*?>/gim, '')
}

export const isEmailValid = (value: string | undefined) => value?.match(/\S+@\S+\.\S+/)
export const isEmailValid = (value: string | undefined) => value?.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/)

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'a' and containing many repetitions of 'a'.

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'a@a' and containing many repetitions of 'a'.

export const getChainIdFromSlug = (network: string | undefined) => {
return Object.values(NETWORKS_INFO).find(n => n.route === network)?.chainId
Expand Down

0 comments on commit 62ffe11

Please sign in to comment.