HTAB (u+0009) in repository items

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 82
Joined: Wed Sep 19, 2018 10:05 am

HTAB (u+0009) in repository items

Post by HansSchl » Fri Dec 11, 2020 10:46 am


I'm struggling with a repository item that represents a menu entry. The item's name is "Show group". It can have a shortcut key assigned to, for example "G". In this case, the item's name is "Show group\tG" where \t means the horizontal tab character U+0009. I am desperately trying to create a regex that matches both cases, but that doesn't match the menu item "Show groups" which exists on the same menu. "^Show group($|\t)" should do, but doesn't work.

During these attempts, I found something that I don't understand:
- The menu item can be identified by "menuitem[@accessiblename='Show groupG']" with no whitespace preceding the "G" ("menuitem[@accessiblename~'^Show groupG']" also works).
- When I use a "Get value" action to retrieve the accessibename and output it to the log, the result is "Show group G" with a space (U+0020) preceding the "G".
- When I create a snapshot of the menu item, the AccessibleName property is reported as "Show group G" with a tab (U+0009) preceding the "G".

This looks a bit inconsistent to me, and makes life difficult. Or is there something I failed to understand?

Thank you