I have a simple solution for this. Just wondering if there's a cool regex trick to do it in one shot.
Given data like this:
<%def .errors>
missing_name: You must provide your name.
missing_email: You must provide your email address.
</%def>
I want to end up with a hash containing the keys and values implied by this format. This was my first try:
my %errors =
( $data =~ m|<\%def \.errors>.*?(?:(^\w+):(.*?)$)+.*?</\%def>|sgm );
But of course that only gets the first one. Is there a way to get them all without first trimming the text?