Imad Posted July 12, 2008 Share Posted July 12, 2008 Hi guys, I have a wordwrap: $word_wrapper = preg_replace('/([a-zA-Z]{49})(?![^a-zA-Z])/', '$1 ', $comment); However, I want it to exclude urls from the wrapper. I tried {unwrap}, but it's not sufficient enough. Any help would be appreciated, Best Regards. Link to comment https://forums.phpfreaks.com/topic/114430-how-to-exclude-urls-from-wordwrap/ Share on other sites More sharing options...
rarebit Posted July 12, 2008 Share Posted July 12, 2008 I've considered this before and tbh i'm not sure, but I did think that: if I checked there was no *'s in the string (choose other if is), then sequentially replace all tags with a *, putting each to an array, then wordwrap and replace back sequentially. But no it doesn't work... unless you leave the link 'title', etc... Should work, but i've never got around to writing it! There are other options, all just as messy... In the end I just wrapped 'em in a div tag... Link to comment https://forums.phpfreaks.com/topic/114430-how-to-exclude-urls-from-wordwrap/#findComment-588417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.