I set out to create an automated action where I could use Shortcuts to take a sentence and de-capitalize just the first word of that sentence. Why? Because on my website I want the first word of the sentence to be on a new line (and thus capitalized) but everywhere else I want the description to be in the same sentence as the app name (thus lowercase).
So, in my AppDeal shortcut, I used regex to grab the first word of a sentence, then used the “action case” to change it to lowercase, and voila, I had a sentence in lowercase.*
You can see the shortcut below (on the left) and it worked great…except it sometimes garbled the text and added extra words at the start, like this:
Best Buy Memorial Day Sale, ending
. grab today, Best Buy has Apple laptops up to $400 off and Apple Series 4 Watches $50 off. Grab a rare deal on Apple hardware!; highly recommended. https://t.co/hvoEApq5Yi pic.twitter.com/UwQX1FwMgB
— MDM Deals (@MDMDeals) May 27, 2019
When I investigated, I figured the problem was my regex. But since I’m no regex expert, I asked the internet again and it came through. The problem was that my regex grabbed the first word of a sentence, any sentence. On the rare occasion that my description had two sentences, it would lowercase both words and add them both in at the start of the description. Oops. The good news is, it wasn’t hard to add a “get items from list” action and grab just the first item (from the first sentence) to change its case. There we go, problem solved. Here’s what the final shortcut looks like (old version on the left, new on the right):
That’s all for today! Tiny little change–one new action–but a change that eliminates the garbled text some of you have been seeing. Hope it might help you in some of your automation! You can download the shortcut here.
Note: Some are reporting inability to access that shortcut, though it works fine for me. If so, here’s an alternate link.
By the way, if you’re reading this and don’t know what MDM Deals is, I’m pretty confident you’ll want to check it out, as it’s a place to discover great deals on fantastic apps and movies, hand-picked and curated by me, five days a week.
*It’s actually more complicated than that. I had to have a separate regex action to grab everything but the first word of the description and then use a text action to re-combine the first word (lower case now) and the rest of the sentence.