Is there a way to trim text (which happens to be a variable from a browser webpage) up to :
the first colon :
first second comma ,
the first [space] dash - or
the first second [space] pipe |?
The reason for this is that I am parsing very long product titles... I want get the most important part of the title .. and I don't want to be cut off mid-word .. and this I think would achieve it
so for example:
1
Sony PlayStation 4 500GB Console (Black) : 1: Amazon.co.uk: PC & Video Games
would become
Sony PlayStation 4 500GB Console (Black)
(due to rule 1)
2
Nintendo Switch (Neon Red/Neon blue) : Amazon.co.uk: PC & Video Games
would become
Nintendo Switch (Neon Red/Neon blue)
3
Golden Swan White Vinegar for Cleaning, Pickling, Marinating & Cooking - Distilled White Vinegar- 5 Litre Bottle - Produced in The UK,5 l (Pack of 2) : Amazon.co.uk: Grocery
would become
Golden Swan White Vinegar for Cleaning, Pickling
due to rule 2
4
Apple iPod classic 160 GB Black - 7th Generation (Renewed)
would become
Apple iPod classic 160 GB Black
(due to rule 3)
5
CHEESIES | Crunchy Cheese Keto Snack | Variety Pack (Selection 1) | 100% Cheese | Sugar Free, Gluten Free, No Carb | High Protein and Vegetarian | Crunchy, Baked and Tasty | Multipack | 6 x 20g Bags : Amazon.co.uk: Grocery
I enabled the macro and pressed play, it seemed to do the trick .
However, I will only be dealing with one title (sentence) at a time. (It's great that your example allows you to run them all at once, but in my use case it's just once sentence and it's coming from '%ChromeTitle%or%FrontBrowserTitle%`.
Oops, going back up the thread, I misread your original requirements.
This version should work, but note that you might need to change the order of the actions depending on the precedence of your 4 rules. As written, the macro first checks for rules 2 and 4. If neither is matched, it checks for rules 1 and 3.
Note also that I added the red action that will always trim trailing spaces. You can remove it if that's not your preference; but without it, due to rule 1, the returned string would include a trailing space for a %ChromeTitle% like this:
Little Plumber : LP1 Water Softener - Perfect For 1-4 Bedroom Houses - Easy To Install - Removes Existing Limescale & Saving up to 70% Heating Costs - Protects & Extends Life Of Appliances : Amazon.co.uk: DIY & Tools