[Israel.pm] (no subject)

Chanan Berler chananb at centerity.com
Wed Feb 4 08:06:53 PST 2009

Currently the only way I found is:

my $str_tmp = $str;
$str_tmp =~ s/HostGroup='(.*?)'//;
$str_tmp =~ s/Host='(.*?)'//;
$str_tmp =~ s/Service='(.*?)'//;
$str_tmp =~ s/ServiceGroup='(.*?)'//;
$str_tmp =~ s/Attempt='(.*?)'//;
$str_tmp =~ s/State='(.*?)'//;
$str_tmp =~ s/REGEX.*$//;

print $str_tmp;

What do think?
Thanks again

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Chanan Berler
Sent: Wednesday, February 04, 2009 5:56 PM
To: 'Perl in Israel'
Subject: [Israel.pm] (no subject)

Hi All,

I am trying for an hour not to parse this string, thought maybe someone has
a better idea:

I need to extract the 'and ' 'or' and 'not' from the statement, still keep
the order (since I need to rebuild the string into sql statement)
Problem: the Service/ServiceGroup or Host/HosName can have the word 'and' /
'or' / 'not'  inside

Str = "HostGroup='generic-hostgroup' and Attempt='5' and
ServiceGroup='Sample Service View' or Service='WINDOWS CPU' and
State='Critical' and REGEX=(| and Mem: (.*?)%|,=,80)

Does anyone has any idea ? maybe just the start..

Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list