Why Doesn't My For Each Match Any of the Switch Cases?

Hello,
Anyone here with experience using For Each & Switch functions?

I'm still working on a macro I shared earlier but currently running into some issues.

Anyone mind sharing similar macros or advice on how to approach it?

Here's the macro if any of you want to take a swing at it!
For Each [Revised].kmmacros (3.8 KB)

[Moderator Edit: Add Macro Image]

image

In the future, please state the exact issues you are having, so us what results you are getting, and what results you want.

Just guessing that your issue is that NONE of the Switch Cases were matched, the issue is simple: Your RegEx of \d\w is not matching anything in your source string.

Try:
\w+

Which will match each of the combinations of a letter followed by a number.

\w -- Matches a "word character": ASCII letter, digit or underscore

You'd have more success if your regex was

\w\d

As for your For Each and Switch actions, they look OK to me but for easier debugging I personally would display my text in a window because the way you've got it they all display so quickly and briefly it's impossible to see what's happening.

I hope you don't mind that I have revised your topic title to better reflect the question you have asked.

FROM:
Anyone with experience using For Each & Switch functions?

TO:
Why Doesn't My For Each Match Any of the Switch Cases?

This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.

1 Like

Thanks for updating the topic title! Great revision.

Thank you both for you help as well. @JMichaelTX @tiffle