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


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;

Regards,
Murugesan Kandasamy
use perl for(;;);