By making this change, we are now passing the string instead of the literal name of the variable. You were actually testing the regex conditions on `$gpa $gpa_key` instead of the string value. The output from my modified version is:my $gpa_key = "azxinetgw.EXECFILE_DIR.azxinetgw='/usr/local/instinet/R +TS/etc/local/azxfiles'"; my $gpa_ret = "gpa: $gpa_key"; warn $gpa_ret; print "gpakey: $gpa_key\n"; #print "gparet: $gpa_ret\n"; if ( $gpa_ret =~ /[^=]+[=][']([^']+)[']/ ) { my $assigned_dir = $1 ; print "$assigned_dir\n";} else { die "couldn't determine assigned directory for $gpa_key" + }
gpa: azxinetgw.EXECFILE_DIR.azxinetgw='/usr/local/instinet/RTS/etc/loc +al/azxfiles' at D:\DATA_TO_MIGRATE\dbexamples\ex\gpa.pl line 7 . gpakey: azxinetgw.EXECFILE_DIR.azxinetgw='/usr/local/instinet/RTS/etc/ +local/azxfiles' /usr/local/instinet/RTS/etc/local/azxfiles
In reply to Re: Regular expression to match an A=B type string needs help in storing matched parts of string
by mrmick
in thread Regular expression to match an A=B type string needs help in storing matched parts of string
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |