I have two strings which I would like to compare.
string1 = www.domain.com
string2 = *.domain.com
Normally, if we use if ($string1 == $string2)..
these shouldn't match as they are not equal, however, since string2 is a wildcard, I would like it to be a match.
Condition(s)
-
*.domain.com
should match with***anything**.domain.com*
-
*.domain.com
should be a mismatch for*domain.com*
or*something.adifferent.com*
- need a solution to support all TLD's i.e.
.com, .net, .org. .com.au
etc..
How can I achieve this?