help with regular expression!
Hi! Need some help with regular expression. I have a url : http://servername:8080/ap/checkmon This url shows "service: OK". I need to monitor the url and also do a content match for OK. If I just put content match equals OK. The url fails, I know i have to do a regular expression match but not sure how. Appreciate if someone can give me the solution as well as explain how to do, because I have other urls to apply this too and there are more OK's I need to check. Below is the sample html code: Appreciate quick help Many thanks Ven Snippet of HTML code: table border=0 id="table1" width='100%' cellspacing="0" cellpadding="0" tr height="200" td align = "left" valign="top" td align = "left" valign="top" td align = "left" >Service:&nbsp; OK</td tr td>&nbsp;</td></tr !-- DB_ALL_OK -
September 28th, 2011 11:38am

you can use "Contains", for RegEx i would try "Service(.+?)OK"
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 1:20pm

Hi! Pavel, Thanks for your reply. Can you pl let me know how we can do it for the below html line? <p style="color: green"> ALL SUCCESS </p> Basically, there are more than one "OK" to be checked, and if any service is down, the corresponding "OK" will change to "Failed". So instead of checking for more than one "OK" I would like to check for "All Success" as stated on the above html line. This is what the html text have when there is an error. <p style="color: red"> SOME FAILED </p> Appreciate your help. Many thanks Ven
September 28th, 2011 1:46pm

it's hard to understand what you are trying to accomplish. there is/are <number_here> health check web page(s) each page provides text status for <number_here> services. please fill in gaps.(number_here).
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 2:19pm

HI! Pavel, Sorry about that. The web page Iam monitoring, when fired in a browser, has something like this ALL SUCCESS service1: OK service2: OK service3: OK So, instead of checking for 3 OKs - I wanted to make it easier and only check for "ALL SUCCESS". and the html line for that is - <p style="color: green"> ALL SUCCESS </p> If any of the "OK's" above is change to failed - the "ALL SUCCESS" will change to "SOME FAILED". Hope, I could explain my requirement. Ven
September 28th, 2011 2:54pm

use does not contain "ALL SUCCESS" or does not match regex "ALL.SUCCESS"
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 4:14pm

Thanks Pavel, One question - should there be quotes or not? use does not contain "ALL SUCCESS" or use does not contain ALL SUCCESS many thanks for your help Ven
September 28th, 2011 5:40pm

Try both :)Microsoft Corporation
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2011 8:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics