If statements matching strings in a list

Hi

I am experiencing problems trying to eliminate some text of a string. The use case comes when I make a draft note for every calendar event
When I Import the Notes field, some times there is garbage in this field, coming from the Teams links, instructions and so forth

Structure is as follows

Notes:

Microsoft Teams meeting
Join on your computer or mobile app
Click here to join the meetinghttps://teams.microsoft.com/l/meetup-join/19%3Ameeting_OTVmYWY1ODYtODA4MS00NWNlLTg4NmYtNDQ3MDhkMWQ3Mzk0%40thread.v2/0?context={"Tid"%3A"0d0f2abc-e8e0-4c83-8727-60ee6ff07889"%2C"Oid"%3A"77bbdf80-8b66-4ca9-ad0a-73420e4f6224"}
Meeting ID: 387 748 936 155
Passcode: 2BsKNk
Download Teamshttps://www.microsoft.com/en-us/microsoft-teams/download-app | Join on the webhttps://www.microsoft.com/microsoft-teams/join-a-meeting
Learn morehttps://aka.ms/JoinTeamsMeeting | Meeting optionshttps://teams.microsoft.com/meetingOptions/?organizerId=77bbdf80-8b66-4ca9-ad0a-73420e4f6224&tenantId=0d0f2abc-e8e0-4c83-8727-60ee6ff07889&threadId=19_meeting_OTVmYWY1ODYtODA4MS00NWNlLTg4NmYtNDQ3MDhkMWQ3Mzk0@thread.v2&messageId=0&language=en-GB

What I am trying to do is splitting by lines and trying to eliminate lines containing those words
Using a List first and then am If sentence for every splitted line

Question: how can I define an “if” statement to compare every item with a “list” of strings?

Attaching the screen shots

Thanks in advance, always appreciative of the support you give to the community guys

Hi @Isi ,

Let’s step back a bit, because I suspect we have a case of the XY Problem.

From the gist of it I feel like going through a list is more work than it’s worth while Regular Expressions may be more adequate.

Are you trying to keep parts of that whole Teams text?

What is your whole process and what are you trying to automate exactly? I’m not familiar with draft notes for calendar events. I know events have notes but not what a draft is in this context. EDIT: got it, you’re talking about the Drafts app (I just saw the tag)

Thanks

I reread your message and I understood better the issue. I gave it a try with a shortcut that uses a Replace Text action with Regular Expression option enabled. So in one action, all the Teams-specific text is removed (even though the URLs vary on each event)

Here it is:
https://www.icloud.com/shortcuts/cf11b89b932e4615b6aad8b907b1f9f3

Hi

Thanks!! While not being able to use regex myself, I do believe this should be the roght method
However once I wrap the action in real use case (see shortcut) the Replace Text action is not working and is not able to trim any of the lines (Microsoft Teams text block still appers)

Any idea of why??

shortcut

Thanks again in advance!!!

What I did was copy the text from your initial post and based my Shortcut on that, but maybe is Microsoft Teams generating notes in ever slightly different ways so that the regular expression doesn’t catch it every time.

I did a new version, this time a bit more flexible, i.e. this shortcut detects then deletes any of the following lines in any order:

  • Microsoft Teams meeting followed by Enter
  • Join on your computer or mobile app followed by Enter
  • Click here to join the meeting followed by any amount of characters, followed by Enter
  • Meeting ID: followed by any amount of characters, followed by Enter
  • Passcode: followed by any amount of characters, followed by Enter
  • Download Teams followed by any amount of characters, followed by Enter
  • Learn more followed by any amount of characters (no Enter here, because it’s the last line)

Here’s the updated version: Shortcuts

About regular expressions used:
^ means the line I want to capture starts there
. means any character
* means any amount of times (so .* means any amount of any characters)
\n means Enter

Happy debugging :slight_smile:

Seb

Thanks Seb!!

Will play overnight after kids will fall asleep. That said first attempt is not promising still so maybe the issue is with Drafts or Variables

My first impression is that Regex is conflicting with the Draft Markdown syntaxis but will get there

Your shortcut is clean and readable to me, so thanks anyway!!! It is great to have that level of support