BongTech
BongTech

Reputation: 41

Karate #regex failed to match string ending with a number

I am trying to match the string ending with a number "Invalid Version. Latest known Version is 110"

The regex matcher I used was:

"#regex ^.+\d+" 

When running the test the output was:

actual: 'Invalid Version. Latest known Version is 110', expected: '#regex ^.+d+', reason: regex match failed

Upvotes: 1

Views: 211

Answers (1)

BongTech
BongTech

Reputation: 41

This worked: "#regex ^.+\\d+"

I missed that I need to put double backslash \\.

Upvotes: 1

Related Questions