kalster Posted February 25, 2014 Share Posted February 25, 2014 I have a large string with html tags in it preg_replace('/([\s\S]{5})(?![^\s\S])/', '$1 ', $output); the regex above chops the long string like below. notice the </p> ddddd ddddd d dddd dd ddd< /p> what i need is like below and with the html tags ignored, still in the string ddddd ddddd ddddd ddddd the above needs to be displayed correctly with the html tags such as bold still in the long string. thank you Link to comment https://forums.phpfreaks.com/topic/286503-php-regex-string-ignore-html-tags/ Share on other sites More sharing options...
.josh Posted February 25, 2014 Share Posted February 25, 2014 you need to be more specific about what tags you want to keep and what tags you want to toss. "toss the paragraph tag but leave the html tags such as bold..." well they are ALL html tags. Also, there are several ways that last part can be bolded. You need to show actual content, a "before" and "after" picture (the viewsource, not the rendered), and exactly what tags you want to keep and toss. "Such as.." is vague. Link to comment https://forums.phpfreaks.com/topic/286503-php-regex-string-ignore-html-tags/#findComment-1470632 Share on other sites More sharing options...
kalster Posted February 25, 2014 Author Share Posted February 25, 2014 in both the title and body of my first post, i stated that i would like the html tags ignored. i found a fix to my first post, so i am marking this topic as solved Link to comment https://forums.phpfreaks.com/topic/286503-php-regex-string-ignore-html-tags/#findComment-1470686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.