On 6/15/06, Bill Stennett - compuserve <[EMAIL PROTECTED]> wrote:
I have a string formatted like this:

my $mystring = 'var1=123::var2=abc456::var3=10.99::var4=def';

What I need to do is to be able to extract name=value. I cannot be sure
where in the list a any value will occur so to extract a value for 'var2'
from the above example would require matching either:

 '::var2=abc456::'

or
 'var2=abc456::'

or
 '::var2=abc456'

Can anyone suggest a regex to do this?


my %NamesToValues = $mystring =~ /([^\:=]+)=([^\:]*)/g

Please donate my beer reward to Doctors Without Borders.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to