Setting regular expression to validate URL format in Adobe CQ5 | AEM Community Blog Seeding | Community
Skip to main content
kautuk_sahni
Community Manager
Community Manager
May 27, 2020

Setting regular expression to validate URL format in Adobe CQ5 | AEM Community Blog Seeding

  • May 27, 2020
  • 0 replies
  • 1866 views

BlogImage.jpg

Setting regular expression to validate URL format in Adobe CQ5 by howtoaem Blog

Abstract

I want to validate a URL inside a textfield using Adobe CQ5, so I set up the properties regex and regexText as usual, but for some reason is not working:


So when I type inside the component I can see an error message at the console:

Uncaught TypeError: this.regex.test is not a function
To be more accurate the error comes from this line:

if (this.regex && !this.regex.test(value)) {
I tried several regular expressions and none of them worked. I guess the problem is the regular expression itself, because in the other hand I have this other regex to evaluate email address, and it works perfectly fine:

/^[A-za-z0-9]+[\\._]*[A-za-z0-9]*@[A-za-z.-]+[\\.]+[A-Za-z]{2,4}$/
Any suggestions? Thanks in advance

Read Full Blog

Setting regular expression to validate URL format in Adobe CQ5

Q&A

Please use this thread to ask the related questions.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.