in reply to Pattern Match n00b
@{$pets} = $1 if $pet_list =~ /$some_variable\:(.+?);?/;
But as the ';' is optional, the non-greedy match would stop matching after the first non-newline character. In your example you would get "b" in $1. It's best not to use "." if you don't really mean "any non-newline character". In your case I think [^;] would be the right thing to use, given that I understood properly what you want to do.
|
|---|