Re: string match question

2013-08-20 Thread Rob Dixon
On 20/08/2013 15:02, Natxo Asenjo wrote: hi, for a nagios (monitoring system) check I need to scrape a web site (this is for a network device, a UPS, whatever). This particular device only offers some functionality through a web interface. I am only interested in the text '1 Critical Alarm Pres

Re: string match question

2013-08-20 Thread Shawn H Corey
On Tue, 20 Aug 2013 16:02:50 +0200 Natxo Asenjo wrote: > I am only interested in the text '1 Critical Alarm PresentA site > wiring fault exists'; is it possible to match this is a simple way (in > fact, the text after 'Critical Alarm Present' may vary, it would be > awesome to be able to get that

Re: string match question

2013-08-20 Thread Matthew K
There are a few ways to do it. It's hard without knowing the data. You could do: $text =~ /Critical Alarm Present([^\.]+)./ ? print "$1\n" : print 0; ;  # if they all end with a period $text =~ /Critical Alarm Present(.*)Recent Device Events./s ? print "$1\n" : print 0;  # if Recent Device Event

Re: string match question

2013-08-20 Thread Jim Gibson
On Aug 20, 2013, at 7:02 AM, Natxo Asenjo wrote: > hi, > > for a nagios (monitoring system) check I need to scrape a web site > (this is for a network device, a UPS, whatever). This particular > device only offers some functionality through a web interface. > > I get the content of the site usi

string match question

2013-08-20 Thread Natxo Asenjo
hi, for a nagios (monitoring system) check I need to scrape a web site (this is for a network device, a UPS, whatever). This particular device only offers some functionality through a web interface. I get the content of the site using WWW::Mechanize after login in (this is really simple using the