in reply to Re^6: replace &
in thread replace &

For example : If the string contain $a= &foo foo When I encode it using the function encode_entities($a); The   should not be encoded. So the final output after encoding should be &foo foo Now the output is &foo foo. So I wanted to check it the string is HTML entity?

Replies are listed 'Best First'.
Re^8: replace &
by Corion (Patriarch) on Jun 04, 2009 at 08:19 UTC

    I don't get your problem. Maybe if you posted real code instead of a mishmash of unencoded and encoded entities outside of <code> tags, it would be clearer. The following code works as I expect it and seems to do what you want:

    > perl -MHTML::Entities -le "print $HTML::Entities::VERSION; print enc +ode_entities('&foo foo')" 1.35 &amp;foo foo

    Which would indicate to me that &foo foo does not look like any valid HTML entity.

    A reply falls below the community's threshold of quality. You may see it by logging in.