how to match a whitespace in a bash variable

According to the man page, the string to the right of =~ is treated as an extended regular expression. I've tried the following things to match an "ok" surrounded by whitespace on either side, but nothing is working. Any idea what I'm doing wrong? Maybe there's a shell option that needs to be enabled?

if ! [[ $RESULT =~ \s"ok"\s ]]; then

if ! [[ $RESULT =~ [:space:]"ok"[:space:] ]]; then

if ! [[ $RESULT =~ [ \t\r\n\v\f]"ok"[ \t\r\n\v\f] ]]; then

NOTE: self answered question below.


Solution 1:

Ok, it turns out one needs [[:space:]] instead of [:space:]. The following works:

if ! [[ $RESULT =~ [[:space:]]"ok"[[:space:]] ]]; then