F
fmassion
Hi folks:
My text (sample):
saddle stitcher: <font color="#008080"><b>repl. of 8 saddle stitcher</b></font> <font color="#8000FF">
Goal:
I want to put numbers in square brakets, but only if they do not occur within tags.
My code:
#!/usr/bin/perl -w
open(IN,'sample.txt') || die("Datei kann nicht geöffnet werden!\n");
my $number = '(?<!<.*?)\d+(?!.*?>)';
while(<IN>) {
$_ =~ s/$number/\[$number\]/g;
print "$_\n";
}
close (IN);
Error message:
Variable length lookbehind not implemented in regex m/(?<!<.*?)\d+(?!.*?>)/at D:\Perl\test.pl line 5, <IN> line 1.
I couldn't find an explanation for this error message. Has anyone an idea?
My text (sample):
saddle stitcher: <font color="#008080"><b>repl. of 8 saddle stitcher</b></font> <font color="#8000FF">
Goal:
I want to put numbers in square brakets, but only if they do not occur within tags.
My code:
#!/usr/bin/perl -w
open(IN,'sample.txt') || die("Datei kann nicht geöffnet werden!\n");
my $number = '(?<!<.*?)\d+(?!.*?>)';
while(<IN>) {
$_ =~ s/$number/\[$number\]/g;
print "$_\n";
}
close (IN);
Error message:
Variable length lookbehind not implemented in regex m/(?<!<.*?)\d+(?!.*?>)/at D:\Perl\test.pl line 5, <IN> line 1.
I couldn't find an explanation for this error message. Has anyone an idea?