[Israel.pm] Regex question: alternation between a delimiter and EOL

Gabor Szabo szabgab at gmail.com
Wed Jan 24 21:38:41 PST 2007


I might be still sleeping but wouldn't

split /;/, $line;

return you all the key=value strings you wanted?

if you wanted a hash of the pairs you would do

%h = split /[;=]/, $line;

Gabor

On 1/24/07, Yossi Itzkovich <Yossi.Itzkovich at ecitele.com> wrote:
> Hi
>
> I have a line like:
> key=value;key=value;key=value
>
> Each fields ends with ";" except the last one in each line.  value can
> not contain ";"
> How can I catch the pair of key=value  ?
> I can't do something like:
> /key=(.+?)(;|$)/
> although I'd like too...
>
> So how can I do it ?
>
> Thanks
>
> Yossi
>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>


-- 
Gabor Szabo
http://www.szabgab.com/
Perl Training in Israel  http://www.pti.co.il/
08-975-2897   054-4624648



More information about the Perl mailing list