Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: Thanks to Ikegami, Chromatic & Corion

by Logicus (Initiate)
on Nov 02, 2011 at 02:33 UTC ( [id://935270]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Thanks to Ikegami, Chromatic & Corion
in thread Thanks to Ikegami, Chromatic & Corion

The escapes need to be the other way around!

my %escapes = ( '&lab;' => '<', '&rab;' => '>', '&lcb;' => '(', '&rcb;' => ')', '&lsb;' => '[', '&rsb;' => ']' );

I need a new escapes_re, because now it's simply destroying all the brackets!

Replies are listed 'Best First'.
Re^7: Thanks to Ikegami, Chromatic & Corion
by Anonymous Monk on Nov 02, 2011 at 02:37 UTC

    I need a new escapes_re, because now it's simply destroying all the brackets!

    Eeeep!

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^7: Thanks to Ikegami, Chromatic & Corion
by Logicus (Initiate) on Nov 02, 2011 at 02:37 UTC

    Got it!

    my %escapes = ( '&lab;' => '<', '&rab;' => '>', '&lcb;' => '(', '&rcb;' => ')', '&lsb;' => '[', '&rsb;' => ']' ); my $escapes_re = qr/&[lr][acs]b;/; $aXML =~ s/($escapes_re)/$escapes{$1}/g;

      That won't work. you need to handle those sequences, <special> and <post_include> at the same time, not before (which would break "&lab;special>lab&lab;/special>") or after (which would break "<special>lab</special>"). I've covered what would work elsewhere.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://935270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-29 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found