Regex matching in spec file

64 views
Skip to first unread message

Truett Kueck

unread,
Aug 30, 2016, 8:32:29 PM8/30/16
to Galen Framework
I'm having issues with matching text using regex in a spec file. Specifically I'm trying to match the string with an endash character. I've verified the regex works using http://regexr.com/ and http://www.regexplanet.com/advanced/java/index.html

Problem string: $92.45–$128.88
Regex: "\\$[0-9]+.[0-9]+\\u2013\\$[0-9]+.[0-9]+"
Spec code: 
text matches "\\$[0-9]+.[0-9]+\\u2013\\$[0-9]+.[0-9]+"
Error message:
  "priceText" text is "$74.95?$129.95" but should match "($[0-9]+.[0-9]+\u2013$[0-9]+.[0-9]+)"

The question mark is likely due to cmder on windows not parsing the endash well.

Truett Kueck

unread,
Sep 1, 2016, 1:49:33 PM9/1/16
to Galen Framework
I managed to get this to work by using the regex "[$][0-9]+[.][0-9]+[\\u2013][$][0-9]+[.][0-9]+"
Reply all
Reply to author
Forward
0 new messages