monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plus character in EXPECT string gives "Invalid preceding regular exp


From: Lukasz Piwowarek
Subject: Re: Plus character in EXPECT string gives "Invalid preceding regular expression" error
Date: Sat, 14 Jan 2012 15:13:50 -0700

Hi

That worked - did not think to try escape with \ - thanks.

Lukasz

On Sat, Jan 14, 2012 at 2:59 PM, Jan-Henrik Haukeland <address@hidden> wrote:

On Jan 14, 2012, at 8:25 PM, Lukasz Piwowarek wrote:

> Hi
>
>
> I am trying to use Monit to check Redis DB like this:
>
>
>         if failed port 6379
>
>                 send "PING"
>
>                 expect "+PONG"
>
>                 send "SET monit_test_key \r\nalive\r\n"
>
>                 expect "+OK"
>
>                 send "EXISTS monit_test_key\r\n"
>
>                 expect ":1"
>
>         then
>
>                 restart
>
>
> The issue is Monit reads the + character as a regular _expression_ and throws an error on start: Invalid preceding regular _expression_.
>
>
> Is there some way around this?

Escape the + or use a character class. That is, either

        expect "\+PONG"
or
        expect "[+]PONG"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]