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 Chanan -----Original Message----- From: [email protected] [mailto:[email protected]] 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.. Thanks Chanan _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
