Your specification seemed to say "match [error] followed by zero or more things contained in square brackets" so I was a bit surprised when your re did not contain the string "error" :) Here is a version that looks for "[error]", not sure if it is any better-
s/( # begin capture \[error\] # "error" in square brackets :) \s* # optional whitespace (?: # non capture \[ # literal [ [^\]]+ # 1 or more non "]" \] # literal ] )* # end non capture ) # end capture /$1<br>/x;
--
my $chainsaw = 'Perl';
In reply to Re: Help with Regex for Apache Error Logs
by greenFox
in thread Help with Regex for Apache Error Logs
by coolmichael
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |