Smarty replace text with urls to links except images

188 views Asked by At

I have text like this:

some text

https://zoom.us/rec/share/hHhxMEBNpVO3wcMUuYcakJFcm6QdJYm3ZU8LVs6Q_atdsRfKE97VjHZOQcFV0Avl.J7s0D8ABUtF28-SX?startTime=1619246702000

<img src="https://clip2net.com/clip/7777/8074e-clip-78kb.png?nocache=1">

I need all url in text replace to link, so https://zoom.us/rec/share/hHhxMEBNpVO3wcMUuYcakJFcm6QdJYm3ZU8LVs6Q_atdsRfKE97VjHZOQcFV0Avl.J7s0D8ABUtF28-SX?startTime=1619246702000 will be

<a target="_blank" href="https://zoom.us/rec/share/hHhxMEBNpVO3wcMUuYcakJFcm6QdJYm3ZU8LVs6Q_atdsRfKE97VjHZOQcFV0Avl.J7s0D8ABUtF28-SX?startTime=1619246702000">https://zoom.us/rec/share/hHhxMEBNpVO3wcMUuYcakJFcm6QdJYm3ZU8LVs6Q_atdsRfKE97VjHZOQcFV0Avl.J7s0D8ABUtF28-SX?startTime=1619246702000</a>

Now i use this code:

{$projectDescription|regex_replace:"#([[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/])#":"<a href=\"\\0\" TARGET=\"_blank\">\\0</a>"}

But this code also replace my img src to href. So issue is how replace all urls except images?

0

There are 0 answers