Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Getting Error in character class - Regex

by murugu (Curate)
on Apr 03, 2006 at 15:52 UTC ( #540966=note: print w/ replies, xml ) Need Help??

in reply to Getting Error in character class - Regex

Adding a space between two [] worked fine for me. This may be due to the fact that perl tries to parse the second '[]' as extra dimension.

Monks, if wrong please correct me.

use strict; use warnings; my %imlre = ('RE1' => ['RE1', 'body', 'measure', 'remove'], 'RE2' => [ +'RE2', 'jcode', '', 'remove']); my $input = '<front>front matter comes here</front><body>bodymatter co +mes here</body><back>back matter</back>'; for (keys %imlre) { if ($imlre{$_}->[3] =~ /^remove$/i) { $input =~ s/<$imlre{$_}->[1] [^>]*>//xg ; #here getting error #$input =~ s/<$imlre{$_}->[1]([^>]*)>//g ; #here no error } } print $input;

Murugesan Kandasamy
use perl for(;;);

Comment on Re: Getting Error in character class - Regex
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2016-02-14 03:19 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (456 votes), past polls