[thelist] Perl regexp question
Richard Bennett
richard.bennett at skynet.be
Tue Sep 3 05:57:00 CDT 2002
Hi,
In a perl parser I'm trying to get the value of a keyword.
Possible values are:
project=main
project =main
project= main
project = main
And all the above with quotes:
project="main"
And with different case:
Project=Main
Just the word main should be returned, in lower case.
what I have so far is this:
$line = "project = main";
$line =~ m/project\s?=\s?"?(.*)"?/i);
$tmp=$1;
$tmp =~ s/"//g;
$tmp = lc($tmp);
But it doesn't seem to work in all cases, and is a bit messy...
any ideas?
Thanks,
Richard.
More information about the thelist
mailing list