How can this regex by improved? It's hitting the PREG_BACKTRACK_LIMIT_ERROR for PHP on very short text
===

The following regex:

    $common_tlds = 'us|me|com|net|org|ly|be|edu|gov|uk|ca|de|jp|fr|au|ru|ch|it|nl|se|no|es|mil|co';

    $regex = '#(?:https?://)?([^.\s]+(?:[^\s.]|[^\s][^\s.])*\.(?:' . $common_tlds . ')[^.\s]*)#i';

used here:

    preg_replace($regex,'<a href="http://$1" target="_blank">$1</a>', $text);

Is giving me a `PREG_BACKTRACK_LIMIT_ERROR` on very short text. One example text is:

`Life cant always give you the best shoes,handbags,clothes but it can give you the best creations.`

I know, there are better link finding regex online, but I was curious about what in my regex was causing massive backtracking and how I could improve it. Thanks!