Re: Another regex match question
Ron Kelley <[email protected]> Tue, 8 Apr 2025 16:12:36 -0400
| Newsgroups | gmane.comp.monitoring.monit.general |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-380BD7BE-2047-412D-8B51-345DE2BB4BA2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Yes, that seems to work. But, what other options can you suggest? I am look= ing at much longer keywords to alert on.=20 Thanks, -Ron > On Apr 8, 2025, at 1:51=E2=80=AFPM, M/Monit Support <[email protected]> w= rote: >=20 > =EF=BB=BF > Hello, >=20 > There are many ways how to write the regular expression, did you try somet= hing like this?: >=20 > if match '[Ee][Rr][Rr][Oo][Rr]' then alert >=20 > Best regards, > The M/Monit team >=20 >=20 >> On 8. 4. 2025, at 18:08, Ron Kelley <[email protected]> wrote: >>=20 >> Greetings all, >>=20 >> I am trying to do a case-insensitive match for the words =E2=80=9Cerror=E2= =80=9D and =E2=80=9Cout of memory=E2=80=9D on our DB servers and am not havi= ng much luck. I saw a few threads from +5yrs ago but the suggestions don=E2= =80=99t seem to work. Also, I looked over the monit manual and the regex(7)= man page but I am still not able to get a simple match working. One thread= suggests to modify the source code and recompile, but that does not seem to= help (I downloaded and compiled monit version 5.34.4) . >>=20 >> Specifically, the syntax: "if match '(?i)error' then alert=E2=80=9D throw= s the error: "Regex parsing error: Invalid preceding regular expression ''(?= i)error=E2=80=99=E2=80=99 >>=20 >>=20 >> Any hints for an easy-to-use case-insensitive match string? >>=20 >> Thanks. >=20 --Apple-Mail-380BD7BE-2047-412D-8B51-345DE2BB4BA2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head><body dir=3D"auto">Yes, that seems to work. But, what other op= tions can you suggest? I am looking at much longer keywords to alert o= n. <br id=3D"lineBreakAtBeginningOfSignature"><div dir=3D"ltr"><div><br= ></div>Thanks,<div><br></div><div>-Ron</div></div><div dir=3D"ltr"><br><bloc= kquote type=3D"cite">On Apr 8, 2025, at 1:51=E2=80=AFPM, M/Monit Support <= ;[email protected]> wrote:<br><br></blockquote></div><blockquote type=3D= "cite"><div dir=3D"ltr">=EF=BB=BF<meta http-equiv=3D"content-type" content=3D= "text/html; charset=3Dutf-8"><div>Hello,</div><div><br></div>There are many w= ays how to write the regular expression, did you try something like this?:<d= iv><br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">= </span>if match '[Ee][Rr][Rr][Oo][Rr]' then alert</div><div><br></div><div>= <div><div> <div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; line-break: a= fter-white-space;"><div style=3D"color: rgb(0, 0, 0); font-family: Helvetica= ; font-style: normal; font-variant-caps: normal; font-weight: normal; letter= -spacing: normal; text-align: start; text-indent: 0px; text-transform: none;= white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Be= st regards,<br>The M/Monit team<br></div><div style=3D"color: rgb(0, 0, 0); f= ont-family: Helvetica; font-style: normal; font-variant-caps: normal; font-w= eight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; t= ext-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-st= roke-width: 0px;"><br></div></div> </div> <div><br><blockquote type=3D"cite"><div>On 8. 4. 2025, at 18:08, Ron Kelley &= lt;[email protected]> wrote:</div><br class=3D"Apple-interchange-newli= ne"><div><div>Greetings all,<br><br>I am trying to do a case-insensitive mat= ch for the words =E2=80=9Cerror=E2=80=9D and =E2=80=9Cout of memory=E2=80=9D= on our DB servers and am not having much luck. I saw a few threads fr= om +5yrs ago but the suggestions don=E2=80=99t seem to work. Also, I l= ooked over the monit manual and the regex(7) man page but I am still not abl= e to get a simple match working. One thread suggests to modify the sou= rce code and recompile, but that does not seem to help (I downloaded and com= piled monit version 5.34.4) .<br><br>Specifically, the syntax: "if match '(?= i)error' then alert=E2=80=9D throws the error: "Regex parsing error: Invalid= preceding regular expression ''(?i)error=E2=80=99=E2=80=99<br><br><br>Any h= ints for an easy-to-use case-insensitive match string?<br><br>Thanks.<br></d= iv></div></blockquote></div><br></div></div></div></blockquote></body></html= >= --Apple-Mail-380BD7BE-2047-412D-8B51-345DE2BB4BA2--