Added URL regex match

This commit is contained in:
Bharat 2021-04-09 01:34:33 +05:30
parent 1640923001
commit 9e145fea13

View file

@ -40,6 +40,10 @@ const PropertyValueElement = (props:Props): JSX.Element => {
const emailRegexp = /^(([^<>()[\]\\.,;:\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,}))$/
return emailRegexp.test(val.toLowerCase())
}
case 'url': {
const urlRegexp = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www\.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w\-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[.!/\\\w]*))?)/
return urlRegexp.test(val.toLowerCase())
}
case 'text':
return true
default: