By default a . in a regex doesn't match \n so your "contents" match doesn't get what you expect. Add a s flag to the regex to give /\Q[[$tag_name]]\E(.*?)\[/s and some of what you want will work better. If you add strictures (use strict; use warnings;) you'll find out that there is more work to do however.
In reply to Re: Can't quite get this regex working
by GrandFather
in thread Can't quite get this regex working
by ultranerds
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |