http://qs321.pair.com?node_id=641675


in reply to Re: Construct a REGEX by selected substitution
in thread Construct a REGEX by selected substitution

How to deal if the $str is :
'<a code=" TXT"> abc =" TXT </a> <text code= TXT> efg =" TXT </text> < +input s=" TXT"> hig =" TXT</input>';
Thanks,

Replies are listed 'Best First'.
Re^3: Construct a REGEX by selected substitution
by GrandFather (Saint) on Sep 29, 2007 at 09:07 UTC

    It looks like what you really need to do is parse some HTML and manipulate some of the elements of the parsed text. However it's not clear just what you want to be able to manipulate, particularly as the sample you've given isn't a well formed fragment of HTML - you seem to have mismatched quote characters. It doesn't help that it's not clear just which TXT instances in the sample ought to be replaced.

    For modest sized documents HTML::TreeParser may be the most appropriate tool for the job.


    Perl is environmentally friendly - it saves trees
Re^3: Construct a REGEX by selected substitution
by jeanluca (Deacon) on Sep 29, 2007 at 09:02 UTC
    Did you read the perlre documentation ? It contains the answer to your question!
    Show us what you've tried or tell us whats unclear about the documentation!

    LuCa