[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Case insensitive regex for MATCH - possible?
From: |
address@hidden |
Subject: |
Re: Case insensitive regex for MATCH - possible? |
Date: |
Tue, 9 Jan 2018 22:03:46 +0100 |
Hello,
Monit regex is currently case sensitive ... if you want case insensitive, you
can:
1.) either rewrite the regex to case-insensitive, for example:
IF MATCH
"(?i)[bB][aA][nN][eE][dD][|L][bB][lL][aA][cC][kK][lL][iI][sS][tT]" THEN ALERT
2.) or modify the regcomp() flags in src/p.y addmatch() function to include
REG_ICASE flag and recompile monit:
regcomp(m->regex_comp, ms->match_string,
REG_NOSUB|REG_EXTENDED|REG_ICASE);
Best regards,
Martin
> On 9 Jan 2018, at 10:21, Sebastian Arcus <address@hidden> wrote:
>
>
> On 09/01/18 09:02, Tino Hendricks wrote:
>> Not having the need nor tested it, but the manual states regex is used
>> according to http://man7.org/linux/man-pages/man7/regex.7.html
>
> Thank you. I read that page while trying to figure things out. There is one
> reference to "case-independent matching", but nothing to indicate how to use
> it or what is the syntax for it. Searching more widely on the internet on
> other software using the same regex library leads me back to the (?i) inline
> syntax - which Monit doesn't appear to accept.
>
>
>> Best
>> Tino
>> Am 8. Januar 2018 um 22:58:26, Sebastian Arcus
>> (address@hidden(mailto:address@hidden)) schrieb:
>>> Hello list. I might be missing something really obvious, but is it
>>> possible to do case insensitive matching with regex's in Monit? There
>>> doesn't seem to be anything about it in the docs, and bizarrely nothing
>>> relevant when searching in Google (to do strictly with regex's in
>>> Monit). I've tried something like:
>>> IF MATCH "(?i)banned|blacklist" THEN ALERT
>>> or
>>> IF MATCH "/banned|blacklist/?i" THEN ALERT
>>> Monit doesn't seem to like either. I've tried various ways suggested
>>> online for Javascript, Python etc. regular expressions - but so far I
>>> haven't been able to figure the right syntax. Any hints please?
>>> --
>>> To unsubscribe:
>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general