Page 1 of 1

Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 11:27 am
by dugovic.milan
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

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 11:33 am
by Martin
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

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 11:54 am
by odklizec
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.

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 11:57 am
by dugovic.milan
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...

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 12:12 pm
by odklizec
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\.(.*)

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 2:14 pm
by dugovic.milan
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:

Re: Validation: Match the value of regular expression

Posted: Thu Jan 19, 2017 2:23 pm
by odklizec
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).