Need a regular expression to validate a single URL/domain value. | Community
Skip to main content

Need a regular expression to validate a single URL/domain value.

  • February 25, 2022
  • 1 reply
  • 0 views

I am using the below regular expression to perform URL validation for an attribute, however it is accepting multiple values

Regular expression: ^(http|https):\/\/[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$

when provided the attribute value as (two domains with comma separated values)  "https://www.thebatmanmovie.com.tw/,https://thebatman.entradaswb.com/" , its not throwing any error.

please help with Regex that performs single url/domain validation at a time.

1 reply

  • February 25, 2022