\w+ doesn't match spaces. Use [^\]]+ instead:
$errmsg =~ /^((?:\[[^\]]+\]){3})(.*)/; or
$errmsg =~ s/^(?:\[[^\]]+\]){3}//;
Update: The directions were correct, but the code was missing a set of parens.
In reply to Re: Problem parsing an error msg with regex
by ikegami
in thread Problem parsing an error msg with regex
by periapt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |