Home > Blockchain >  regex assistance - 1 case I need to handle yet
regex assistance - 1 case I need to handle yet

Time:10-18

This is kind of doing what I want, but is failing one case I'd like to be true. Yes, I will be using this with domains, but before someone goes on and on about how this won't work for whatever domain, there is more needed to validate it correctly, and so on... this WILL work fine in my use case if I can handle these two last cases. I do not need to validate correct format, just need to make sure it handles the cases I mention below. Basically I am looking for :

  • any *.extension (a-z more than 2 chars) to be true
  • any domain.extension or unlimited-subdomains.domain.extension to be true
  • either of the above where the entire string starts with *. to be true

What I have gotten so far :

enter image description here

  • Related