Get Index ID for matched text for split text Shortcuts

Hi there Automators team,

I am trying to refine a shortcut I have been working on for months. I am looking at Siri Shortcuts for replacing the retirement of my favourite weather app. However my trouble is the text keeps moving day to day. If I can match the text or find the ID of one known part I can find other text relative to it. However I don’t know if a way for shortcuts to get me the original Index ID for matched text from a larger split text. Has anyone done this before? I’ll send more details if needed. I have some screenshots below of what actions I thought would work
Thank you if you reply! :grin:

Have you considered using their API instead?

Agree that the API is probably the better method, but if you’re just looking to parse the text to get the forecast for a particular day you could try something like this (you’d obviously need to replace the hard coded date strings).

Thank you to both of you. I will try creating two shortcuts with both of your suggestions using your ideas for getting the data. @RosemaryOrchard method is easier to understand but needs more parsing and shortcut steps.
@RogerDowning, your method appears as sorcery to me. In 5 steps you got the result I wanted. I know I am not skilled in Regex but I am willing to learn it if you could explain further what your expression is doing. I may have to re-listen to the latest Automator’s Podcast on Regex to understand what you’re doing.
Thank you so much for your assistance in pointing me in the right direction!

He’s capturing a match for Wednesday 6 November followed by either any character (the . ) or (the | symbol is or) a newline (the \n ), repeated from 0 to any number of times (the * means whatever is in the preceding parens can occur 0 to any number of times).

The outside parentheses around that makes that one capture group. Then he has a separate capture group for the following day. I think he’s doing that just so the first capture group doesn’t run on forever and include everything after Wednesday 6 November. By doing that second capture group for the next day, he limits the first capture, the one you care about, to one day’s worth of data.

Please feel free to correct any mistakes I’ve made here if I’m mistaken in my understanding.

Yes, that’s correct.

The attached image from RegEx Knife which I used to build the regular expression may help to illustrate what is happening.

1 Like

Thanks so much, I have just downloaded the app now so I’ll play around with it in the coming days. Shortcut has worked flawlessly using your method and I was able to get the forecast for the rest of the week using current date and formatting it to the future date. Thank you again for your help