sorry I don't get it. I want to convert a Linktext by using preg_replace with this options:
- Text to HTML (incl. Link)
- Trim the text until domain (no https:// or http:// or www.)
- Shorten a long URL (e.g. to 20 signs)
So, this text:
https://stackoverflow.com/questions/ask
should be converted to this output:
<a HREF="https://stackoverflow.com/questions/ask">stackoverflow.com/quest...</a>
For the question No.1 I have this solution:
$linktext = preg_replace("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a href=\"$1\">$1</a>", $linktext);
...but than it's impossible to change this variable to question 2 and 3.
Any ideas how to fix this to have ONE replace-operation (with arrays or something)?