Regex to extract social media posts from open ai suggestions

Im using the “text parser > match pattern” module as per the premade template and i cant get the regex to extract the text as needed

Template https://eu2.make.com/templates/10696-post-directly-on-social-media-from-a-blog-using-chatgpt

The regex is (?<=Tweet:)[\s\S]?(?=LinkedIn Post)|(?<=LinkedIn Post:)[\s\S]?(?=Facebook Post)|(?<=Facebook Post:)[\s\S]*

And openai output text is

Tweet:
“Maximise your pension contributions and secure your financial future with our latest article on effective pension planning. Learn how to grow your retirement savings and navigate workplace pension schemes. #PensionPlanning #FinancialSecurity

LinkedIn:
Are you looking to maximise your pension contributions and secure your financial future? Our latest article delves into the strategies and benefits of effective pension planning. Learn how to grow your retirement savings, understand tax relief, and manage contribution limits. Read more here: [insert link] #PensionContributions #RetirementPlanning

Facebook:
Looking to maximise your pension contributions and secure your financial future? Our latest article explores the importance of effective pension planning, including strategies for growing your retirement savings, understanding tax relief, and managing contribution limits. Discover how you can navigate workplace pension schemes and make the most of your pension options. Read the full article here: [insert link] #PensionPlanning #FinancialSecurity

Looks like the regex is looking for “LinkedIn Post:” while the text contains “LinkedIn:” instead. Same for Facebook. Remove " Post" (including the empty space before it) from all of them and it should work.

Here is a good tool to test and build regular expressions: regex101: build, test, and debug regex

2 Likes

Great, thank you! The output is now matching but showing them as fallback matches, is that correct?

OUTPUT

  • Bundle 1Collection

    • i

1

  • Fallback Match

Exciting news from the 2024 Spring Budget! Learn about the latest changes to National Insurance, tax incentives for property investors, child benefit thresholds, and more in our latest blog post. #SpringBudget #TaxChanges #UKEconomy [Link to the blog post]

  • Bundle 2Collection

    • i

2

  • Fallback Match

The 2024 Spring Budget has brought significant changes to fiscal policy and economic forecasts. From National Insurance cuts to tax incentives for property investors, there’s a lot to unpack. Read our latest blog post to stay informed about the latest updates: [Link to the blog post] #SpringBudget #TaxChanges #UKEconomy

  • Bundle 3Collection

    • i

3

  • Fallback Match

The 2024 Spring Budget has introduced key changes that will impact individuals and businesses across the UK. Learn about the reductions in National Insurance rates, changes to tax incentives for property investors, updates on child benefit thresholds, and more in our latest blog post. Stay informed and read all about it here: [Link to the blog post] #SpringBudget #TaxChanges #UKEconomy