RedditPP Mascot

RedditPP

r/tasker • … • u/Kryptonicus

Variable Search Replace is driving me crazy! Would you be willing to review this code?

I have a task that captures some text from a reddit post via AutoInput UI Query. My goal is to remove part of that text and then return the result as a string. I cannot get Variable Search Replace to work on this at all. I've verified that my regex is valid at regex101.com. But the task isn't writing any data to the new variable. I'm completely out of ideas. The goal of my search and replace is to remove the first paragraph ending in "input!" from the input text and then return everything starting with "Here is your daily cheese facts:".

Here's my task (the raw text I'm using follows):

A1: AutoInput UI Query [ Configuration: App Package: com.laurencedawson.reddit_sync.dev Text: Here is your daily cheese facts: Variables: cheesedata(), cheesetitle Timeout (Seconds): 20 ]

A2: Write File [ File: Documents/cheesetesting2.txt Text: %cheesedata() *************** %cheesetitle ******1****** %cheesedata(1) ******2****** %cheesedata(2)

Add Newline: On ]

A3: Variable Search Replace [ Variable: %cheesedata(1) Search: (?<= input! )[\s\S]* Multi-Line: On One Match Only: On Store Matches In Array: %brandnewdata Continue Task After Error:On ]

A4: Variable Search Replace [ Variable: %cheesetitle Search: (?<= - )[\s\S]* Multi-Line: On One Match Only: On Store Matches In Array: %brandnewtitle Continue Task After Error:On ]

A5: Write File [ File: Documents/cheesetestingpost.txt Text: %cheesedata() *************** %cheesetitle ********MASSAGED CHEESE DATA:******** %brandnewdata

Add Newline: On ]

A6: Flash [ Text: %brandnewdata - %brandnewtitle Continue Task Immediately: On Dismiss On Click: On ]

A7: Flash [ Text: Done %cheesetitle Continue Task Immediately: On Dismiss On Click: On ]

Input text from AutoInput UI Query:

>I’m using stock images but I am always on the lookout for new cheeses to try whenever I go to the store. Credit to “Taste Atlas” for the cheese image and cheese facts. If any of you know some cheeses that I haven’t done yet I would love some input! > >Here is your daily cheese facts: Serra da Estrela cottage cheese is a milk product obtained by heating and curdling unpasteurized sheep milk from the. . . > >"Cheese Title": Day 716 - Requeijão Serra da Estrela

— 0