in reply to regex question

the #s at the end of the string

When asking help on regular expressions, please show several pieces of example input, for example we don't know what these #s are. Even better, use the following template, it will help you while you work on the regex as well:

use warnings; use strict; use Test::More; my $regex = qr/foo(.+)/; like "foobar", $regex; ok "foobar" =~ $regex; is $1, "bar"; unlike "quzbaz", $regex; # ... lots more test cases here! done_testing;

Update: Added demonstration of how to test $1 etc. to the above code.