Trying to understand your question: In the first post you were told how to find the right hand side of DEPLOY_PARAMS=$DOMAIN{HOST},$DOMAIN{IP},$DOMAIN{CONFIG} and now you want to extract what's within the braces? Like this:
use strict; use warnings; my $str='$DOMAIN{HOST},$DOMAIN{IP},$DOMAIN{CONFIG}'; my @result = $str =~ /{(.+?)}/g; print "@result\n";
Update: Putting it all together:
use strict; use warnings; use Data::Dumper; my %h = map {my($k, $v)=/^(.*?)=(.*)/; $v=[ $v=~/{(.+?)}/g ] if $v=~/} +/; $k=>$v } <DATA>; print Dumper \%h; __DATA__ DEPLOY_TIME=300 DEPLOY_TYPE=OS DEPLOY_PARAMS=$DOMAIN{HOST},$DOMAIN{IP},$DOMAIN{CONFIG} DEPLOY_DEFAULT_STARTUP=$DOMAIN{STARTUP.INI} DEPLOY_DEBUG=Y DEFAULT_EXPIRY=900
In reply to Re: Regex random values pattern match and code efficiency
by hdb
in thread Regex random values pattern match and code efficiency
by Mark.Allan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |