For several hours I'm trying to ride my fair one script and end up almost ready, but it gets weird problem.
Attach a piece of code to get an idea what I mean.
$sep = '\.com|\.tv';
$string = 'sub.sub2.sub3.tv-bole-el.com';
$pat = '~[-[:alnum:]]{2,}\b('.$sep.')\b~i';
preg_match_all($pat, $string, $matches, PREG_PATTERN_ORDER);
In this case in array $matches, it would be correct if you spend tv-bole-el.com
Instead, I earned 2 domains:
- sub3.tv
- -bole-el.com
Anybody have an idea where is wrong?