I made the following changes to your regular expression:
[\\w\\d]changed to \\w. The word char ( \w) also includes the number ( \d).+after (-[\\w\\d]+)changed to *. -...the name of the part (sub) is optional.- Then I added
\\*?for the (optional) final star.
So my regex, without a double backslash, is as follows:
^(https?://)?((\*|\w+(-\w+)*)\*?\.)*(\w+)((\.\w{2,63})?)$
source
share