![]() |
str_ireplace but not within a link tag
I am trying to do a str_ireplace on a long string that can contain links. However I dont want to replace an occurance if it within a <a></a> tags.
The way I was thinking was to explode the string into parts based on the link. so I want the first piece to contain a part of the string part 2 to contain the link part 3 to contain more of the string. Then I can loop through skipping every other part them implode it all back together. The problem is that I cannot set a wildcard (or just dont know how) within my str_ireplace tag. I would want something like str_ireplace("<a*</a>", $string); where the * is a wild card. Any ideas? |
This is the part when you would use regular expressions. Capture the parts you don't want to make replacements into, replace all the other parts, and recompose the string.
|
| All times are GMT. The time now is 09:12 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0