Question about regular expressions in Robot Framework

1,190 views
Skip to first unread message

Kirill Zhukov

unread,
Aug 17, 2014, 9:09:28 PM8/17/14
to robotframe...@googlegroups.com
I have two strings. The first one I am getting as output from console which could be Added File <file_path> or Updated File <file_path>. I am using this keyword which doesn't work:
Should Match Regexp  ${response}    Added|Updated File ${file_path}
where ${response} is output from console. I am getting "Updated File <file_path>" doesn't match "Added|Updated File <file_path>".

I am not sure how to use exactly reg exps in Robot Framework. Need some help :)

Thank you!

Kevin O.

unread,
Aug 18, 2014, 12:33:47 PM8/18/14
to robotframe...@googlegroups.com
If you have an alternative with more than one characters, you need to surround the whole thing with parentheses. Try:
Should Match Regexp  ${response}    (Added|Updated) File ${file_path}

Kirill Zhukov

unread,
Aug 18, 2014, 12:41:18 PM8/18/14
to robotframe...@googlegroups.com
Thank you for response! I resolved the problem and that's quite stupid because in log I was getting "f" letter instead of "F" in "file" word :D

Tatu Aalto

unread,
Aug 19, 2014, 6:43:59 AM8/19/14
to zhukov.k...@gmail.com, robotframework-users

Ugh

RF regular expression are based on Python regular expressions. I usually use validator [1] to check my expressions.

-Tatu
Send from my mobile
[1] https://pythex.org

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages