Use regex in UFT PDF comparison

232 Views Asked by At

In one of my UFT test cases, I need to verify a amount on a PDF file.

Sometimes the amount is "3000" and sometimes it is "3.000". And sometimes even "3 000"!

I would like to accept those 3 possibilities, knowing that this amount is stored in a datatable.

I tried something like "3.?000" (with regex check in the file checkpoint) but it's not matching any of the 3 solutions.

How would you do?

1

There are 1 best solutions below

3
Motti On

One of UFT's idiosyncrasies when dealing with regexs is that it add implicit anchors at the beginning and ends of lines. Try adding .* before and after the text you want to match - .*\s3[., ]?000\s.*.

Also verify that you've activated the regular expression flag for your line. I find the UI for File Content Checkpoints to be a bit unintuitive so you may have missed that.

Screen shot of line with regex flag selected