Instead of trying to do everything with a single regular expression, consider breaking it up into two.
$str =~ s/\[id=(\d+)\]/<a href='...$1'>/g; $str =~ s/\[\/id\]/<\/a>/g; print $str;
This will deal more gracefully with links that span multiple lines (which often happens when people write in a auto-wrapping editor.)
In reply to Re: Re: Monks' Expression
by eg
in thread Monks' Expression
by sinan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |