[thelist] Regular Expression Question
Beau Hartshorne
beau at hartshorne.ca
Sun Nov 9 10:23:01 CST 2003
I am trying to write a function that takes an array of tags and an html
encoded string as input, and then selectively decodes the encoded string
based on the array of tags supplied. I am not using html_entity_decode
because I only want to decode the " entities that lie in between <
and >. I want to leave the "s that are outside of the < and >
alone.
BTW, I made a typo in my example (I had forgotten the = sign after
target). Here's the fixed version:
She said "hello, world" [<a target="_new"
href="link.html">1</a>]
Is translated to:
She said "hi, there." [<a target="_blank"
href="link.html">1</a>]
Cheers,
Beau
> I don't try to do regex ... I'm still learning it myself.
> However, I am
> curious why you aren't using html_entity_decode()?
>
> (slightly modified manual example):
>
> $orig = "I'll "walk" the <b>dog</b> now";
> $b = html_entity_decode($orig);
> echo $b;
> echo "\n";
>
> This gives me
>
> I'll "walk" the <b>dog</b> now
More information about the thelist
mailing list