in reply to Regular Expression
If the earlier replies did not resolve the problem, then something besides the RE is faulty.
Perhaps the output you are examining did not come from the result of the RE, due to an intervening localization of $_. Also, some output (NUL, etc.) is not visible in some terminals or editors.
Try dumping $_ immediately before and after the RE. Data::Dumper, with its 'qq' mode turned on, will expand any oddball characters into readable forms.
Output:#!/usr/bin/perl -w use strict; use Data::Dumper; $Data::Dumper::Useqq = 1; $_ = join '', <DATA>; print "\nBefore: ", Dumper($_); $_ =~ s/<IT>\s*<\/IT>//gi; print "\nAfter: ", Dumper($_); __DATA__ Foo<iT></It>Bar Baz<it>!</it>Qux
Before: $VAR1 = "Foo<iT></It>Bar\nBaz<it>!</it>Qux\n"; After: $VAR1 = "FooBar\nBaz<it>!</it>Qux\n";
|
|---|