Hi,
I'm having an issue where I want to use get value and regex to strip off the characters/whitespace and just be left with numbers and decimals. I have used the regex tool within Ranorex and found two solutions that would be suitable however when I run through the test the figure that is processed is not the expected one. Bizarrely I have used two completely different methods which both result in the same wrong figure, cant really see how its possible
59.4 GB with a regex of [^ GB]
Expected result 59.4
Actual result 5
59.4GB with a regex of [1-9.]
Expected result 59.4
Actual result 5
I have attached pictures of the test results any ideas would be appreciated
Issues with get value/regex
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Issues with get value/regex
You do not have the required permissions to view the files attached to this post.
Re: Issues with get value/regex
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 59
- Joined: Fri Jun 22, 2018 8:59 am
Re: Issues with get value/regex
That works thanks
how is it that works and my other solutions didn't?

Re: Issues with get value/regex
Hi,
My solution uses positive lookahead, where it searches for 'space' (\s) followed by 'GB' string and then it returns all characters before the found string (in one group).
Both your solutions match individual characters and not entire string, so they both returns 4 individual groups, containing '5', '9', '.' and '4'. And Ranorex apparently obtains first match, so you thought it returned only '5'
Try both your and mine solution in Ranorex Regex toolkit and you will see what I mean.
My solution uses positive lookahead, where it searches for 'space' (\s) followed by 'GB' string and then it returns all characters before the found string (in one group).
Both your solutions match individual characters and not entire string, so they both returns 4 individual groups, containing '5', '9', '.' and '4'. And Ranorex apparently obtains first match, so you thought it returned only '5'

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration