Text parser: Adapting pattern to Make regex

Hi Makers, my scenario includes a text parser to extract references from Stripe payment notifications. I’m using ECMAScript for a pattern —\s(.?)\s$*, which works fine in regex101, but doesn’t yield results the same way in Make.

Here’s the input bundle:

[
    {
        "text": "Congratulations Zbulo! Discover Albania!\n\nYou've just received a payment through Stripe.\n\n-\nPayment\n\n€X.X  (https://dashboard.stripe.com/b/xxx?destination=%2Fpayments%2Fpi_3OepEq2tY2gbLSji1XUuoXq7) — **LOPOB2402-MR**\n\n-\nView in Dashboard : https://dashboard.stripe.com/b/xxx?destination=%2Fpayments%2Fpi_3OepEq2tY2gbLSji1XUuoXq7\n\n-\nPayment ID\n\xxx\n\nWe are here to help. Visit our Support website (https://support.stripe.com/) for answers to the most common questions and to get in touch with us.\n\n===\nThis email relates to your Zbulo! Discover Albania Stripe account.\nAccount ID: xxx\n\nNeed to refer to this message? Use this ID: xxx\n\nStripe Technology Europe, Limited is an Irish limited company. Registered number: 0599050. Registered office: 25/28 North Wall Quay, Dublin 1, D01H104\n\nYou are subscribed to Successful payments emails. Manage your communication preferences here: https://dashboard.stripe.com/b/xxxxx?destination=%2Fsettings%2Fcommunication-preferences%23successful_payment_emails"
    }
]

Welcome to the Make community!

According to the Text Parser page in the Make Help Center:

Match Pattern

  • For experimenting with regular expressions, we recommend the regular expressions 101 website. Just make sure to tick the ECMAScript (JavaScript) FLAVOR in the left panel.

If you do not do this before using the site, your regex may be incorrect as it uses the PCRE regex by default (which is slightly different from ECMAScript/JS).

Once you select the correct version, you can see why it isn’t working:

Screenshot_2024-02-01_194204

Hope this helps!

3 Likes

Thanks, I indeed switched the flavor only after entering the pattern and string, not realizing that this wouldn’t update the check and keep displaying the result of the previous selection.

I struggled with making the ECMAScript work myself and asked GPT for help, after a few attempts it came up with €[^\s]+ —\s([^\n\s]+)\s*, which looks more complex than necessary but works. :slight_smile:

2 Likes

If you need help with regex stuff in the future, may I suggest that you also include the content or “test string” in your question? This way others can also help you formulate the pattern that you need.

You can also save the regex101 and share the link :slight_smile:

3 Likes