Hey!
I need help making a preg_replace() command to replace some stuff on my webpage.
I've got a text like this:
"click !:here:! to get some info about some stuff";
and another variable, with the URL for a link, that will change often. So I want to use preg_replace to replace the !: and the :! with <a> and </a> tags.
So I'm thinking something like this
so the regexp, I don't really know if that's any good at all. It's just something I think might be correct. The thing is that the link could be anywhere in the string $infotext, and with any chars between the !: and the :!.. possible that I might want to change the symbols !: and :! too. I'm not really good at REGEXP.Code:preg_replace("/!:(.*):!/", "<a href='{$URL}'>$text</a>", $infotext);
the $text variable shall be taken from the regexp search-pattern. Because the text between !: and :! will change quite often too.
Hope this is possible.
Cheers,
Artheus


Reply With Quote

Bookmarks