Validation: Match the value of regular expression

Ask general questions here.
dugovic.milan
Posts: 41
Joined: Wed Jun 29, 2016 1:19 pm
Location: Frankfurt, Germany
Contact:

Validation: Match the value of regular expression

Post by dugovic.milan » Thu Jan 19, 2017 11:27 am

Whenever I set the validation point and have my Regex inside of my pre-defined repo element (for example on AccessibleName property), Ranorex doesn't update the match value and the validation will fail in the end. Am I doing something wrong or this is more of a "user-voice issue"? :roll: Thanks
Ranorex 8.3.0

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Validation: Match the value of regular expression

Post by Martin » Thu Jan 19, 2017 11:33 am

Hey

Could you please give more information regarding your issue.

Code sample, repo element and a snapshot (not a screenshot) of the problematic item would be great.

Martin

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validation: Match the value of regular expression

Post by odklizec » Thu Jan 19, 2017 11:54 am

Agree with Martin, please post some more details, like the exact xpath you are using in repo, including the regex you are using. Also an example of valid AccessibleName (which currently fails) would be great. Thanks.
Pavel Kudrys
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

dugovic.milan
Posts: 41
Joined: Wed Jun 29, 2016 1:19 pm
Location: Frankfurt, Germany
Contact:

Re: Validation: Match the value of regular expression

Post by dugovic.milan » Thu Jan 19, 2017 11:57 am

Unfortunately I cannot send you a snapshot...

But What I can do is:
- Adapter: Text
- Attribute: AccessibleName "ABHMB.[a-zA-Z]"
- And I wanna make Validation against this adapter with provided attribute... But when I do this, the default captured value is selected (ABHMB.Abmeldung.020102) as the "match value" in my recording module and when I type in the same thing as in the AccessibleName property is, my validation fails.

Hope this helps both of you...
Ranorex 8.3.0

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validation: Match the value of regular expression

Post by odklizec » Thu Jan 19, 2017 12:12 pm

If I understand your problem right, you want to validate the AccessibleName by string starting with "ABHMB." and the rest of string is not important to you? So I would suggest to use regex like this:

Code: Select all

^ABHMB\.
or

Code: Select all

^ABHMB\.(.*)
Pavel Kudrys
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

dugovic.milan
Posts: 41
Joined: Wed Jun 29, 2016 1:19 pm
Location: Frankfurt, Germany
Contact:

Re: Validation: Match the value of regular expression

Post by dugovic.milan » Thu Jan 19, 2017 2:14 pm

Well ultimately... I'm having issues with Validation method, not with the syntax of regular expression. Long story short - you can't use Regex inside of "match value" field :roll:
Attachments
accessiblename.png
accessiblename.png (55.76 KiB) Viewed 1395 times
Ranorex 8.3.0

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validation: Match the value of regular expression

Post by odklizec » Thu Jan 19, 2017 2:23 pm

You just need to use AttributeRegEx instead of AttributeEqual. The only downside is, that AttributeRegEx currently does not support mixing variables with regexes. So if you want to use regex with variable, you need to convert the action to user code and combine regex with variable in code (as discussed for example here).
Pavel Kudrys
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