Note: this is a theoretical question about PHP flavor of regex, not a practical question about validation in PHP. I am merely using Domain Names for lack of a better example.
"Second Level Domain" refers to the combination of letters, numbers, period signs, and/or dashes that are placed between http:// or
http://www. and .com (.co, .info, .etc) .
I am only interested in second level domains that use English version of Latin alphabet.
matches valid domain names, such as stackoverflow, StackOverflow, stackoverflow.co (as in stackoverflow.co.uk), stack-overflow, or stackoverflow123.
However, the same pattern would also match something like stack...overflow, stack---over--flow, ........ , -------- , or even . and -.
How can that pattern be rewritten, to indicate that period signs and dashes, even though they can be used multiple times in a node,
- cannot be used without other symbols,
- cannot be placed twice or more side by side with each other,
- and cannot be placed in the beginning or end of the node?
Thank you in advance!