Robot framework - Should contain match with regex - does not contain match for pattern error

I have the following robot file with defined keyword to run any command on a linux machine. In this case, I am attempting to find the mount permissions on the volume. However the regex doesn't match.

${output}   run command   cmd=stat -c %a /volume1
Should Contain Match   ${output}   770

Logs display the below error:

20210722 13:58:20.184 - INFO - +---- START KW: Collections.Should Contain Match [ ${output} | 770 ]
20210722 13:58:20.185 - FAIL - [ 770
 ] does not contain match for pattern '770'.

Not sure what I am missing in this case. Any help is appreciated.

Upvotes: 1

Views: 2683

Answers (1)

Ryszard Czech
Ryszard Czech

Reputation: 18611

Using glob pattern:

Should Contain Match   ${output}   glob=*770*

Using regex:

Should Contain Match   ${output}   regexp=770

Glob mode is default, and needs to find a match that equals the entire string.

Upvotes: 1

Related Questions