I found these two expressions in documentation:
To match subdomains of mydomain.com: (^|.*\.)mydomain\.com
To match domain and subdomains of mydomain.com: (^|.*\.)*mydomain\.com
I can't understand why those expressions mean what they say they mean. Can anybody explain both expressions please?
Fist it is not a good regex expressions (it except other things that it should not) but i will explain the
(^|.*\.)mydomain\.com(you will figure out the second)^matches the starting position of the line|acts like a Boolean OR ,between the expression before and the expression after the operator.matches any character except line breaks*Matches the preceding element zero or more times\.matches a dot.characterFor more information you could read wiki doc and use a great Regex tool