Regex: What's the Syntax for Wildcard in Pause Until Menu Conditions Met?

Using Pause Until Conditions Met…, I’m trying to verify that a certain browser window exists, before proceeding with the rest of the macro. BUT the name of the window can vary (e.g., “Tech Companies of Canada” or “Tech Companies of the United Kingdom”). I only care that there exists at least one window named "Tech Companies of " (wildcard) — so I can select that window (already loaded) and proceed with the macro.

HOW DO I…? Use regex to form a wildcard for the 2nd part of the window name?

I’m not a programmer, and I only know enough regex to be dangerous. :slight_smile: That said, if I have a good template or example of the syntax, I can usually get it to work.

I looked, but I couldn’t find any examples for the syntax of a regular expression in the Menu Item field with a literal and a wildcard. Something like this:

Pause Until Conditions Met > Pause until… All of the following are true: > A menu item: > with path* > [Window > “LiteralPartofMenuItemName”+wildcard] > is enabled. See snapshot…

By the way, I need to use the “with path” option, because I don’t want the action to validate on any of the instances that are stored in the browser’s history, under a different menu. The action should only return a valid match if the window name exists under the Window menu.

Thanks in advance for any advice or examples of syntax!

I should have said: "exists" (not "is enabled"). Here's the snapshot...

Try something like this:

The "^" character means the start of a regex expression. In this case, it will match something starting with "Macr".

Dan, a thousand thanks — works like a charm!

Wondering: Is there any field in KM where I CAN’T use this approach?

Hey! I helped someone! Woo Hoo! LOL

Good question!

This technique (using an ^ to indicate a regular expression) only works in select menus and pressing buttons, both of which use either regular expressions (if the field starts with a ^) or alternates (A|B|C), dot-dot-dot (...) to match ellipsis (…), and menus also allow for APPLICATION as a match against the current application.

Hey Jeffrey,

What browser are you working in?

-Chris