Re: Another regex match question

M/Monit Support <[email protected]> Tue, 8 Apr 2025 19:51:00 +0200
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <[email protected]>
--Apple-Mail=_C9090978-21EF-4FE6-A57E-ADA04C2838F3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello,

There are many ways how to write the regular expression, did you try =
something like this?:

	if match '[Ee][Rr][Rr][Oo][Rr]' then alert

Best regards,
The M/Monit team


> 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 =
having 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 =
throws 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.


--Apple-Mail=_C9090978-21EF-4FE6-A57E-ADA04C2838F3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><div>Hello,</div><div><br></div>There are many ways =
how to write the regular expression, did you try something like =
this?:<div><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: after-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;">Best regards,<br>The =
M/Monit team<br></div><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;"><br></div></div>

</div>
<div><br><blockquote type=3D"cite"><div>On 8. 4. 2025, at 18:08, Ron =
Kelley &lt;[email protected]&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><div>Greetings all,<br><br>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 having =
much luck. &nbsp;I saw a few threads from +5yrs ago but the suggestions =
don=E2=80=99t seem to work. &nbsp;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. &nbsp;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) .<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 hints for an easy-to-use case-insensitive match =
string?<br><br>Thanks.<br></div></div></blockquote></div><br></div></div><=
/body></html>=

--Apple-Mail=_C9090978-21EF-4FE6-A57E-ADA04C2838F3--