Post

#PowerPlatformTip 120: 'PowerAutomate, Text Processing 2.0'

#PowerPlatformTip 120: 'PowerAutomate, Text Processing 2.0'

TL;DR: Power Automate has no regular expressions, and extracting text with split(), indexOf() and substring() gets long fast. Power Tools by Paul Murana is a paid custom connector with C# code that adds actions like Regular Expression Match, Extract Text Between Two Strings or Clean Text. It’s a third-party product and needs a Power Automate premium license. For simple cases, the standard expressions below are enough.

💡 Challenge

Typical text jobs in a flow: pull an order number out of an email, collect every email address in a text, remove control characters, or find all values between two markers. Workflow expressions have no regex function, so each of these turns into nested split(), indexOf() and substring() calls or an Apply to each over the text.

✅ Solution

Two routes:

🔸 Standard expressions for single, predictable patterns, without extra cost.

🔸 Power Tools by Paul Murana for regex, multiple matches and other heavier text work, as a ready-made connector. It’s a commercial product from an independent vendor, not a Microsoft feature.

🔧 How It’s Done

1. Try the standard expressions first.

🔸 Text between two markers (first occurrence), for example the order number in Order: 4711; Customer: ...:

1
first(split(split(variables('Text'), 'Order: ')[1], ';'))

🔸 Remove line breaks and surrounding spaces:

1
trim(replace(replace(variables('Text'), decodeUriComponent('%0D'), ''), decodeUriComponent('%0A'), ' '))

🔸 These work as long as the markers are fixed. If the marker can be missing, wrap the call in a condition with contains(), otherwise [1] fails at runtime.

2. Use Power Tools when the pattern varies.

🔸 Power Tools is a custom connector with C# code: the actions run inside the connector in your environment. The vendor delivers it as a solution that you import into your environment. Purchase and current prices are on the vendor’s website.

🔸 Actions include Clean Text, Extract email addresses from Text, Extract Text Between Two Strings, Extract Multiple Texts between Strings, Regular Expression Match, Regular Expression Batch Match, Regular Expression Replace, Extract Text from Word Document, JSONPath, XSLT Transform, Aggregate, Merge Arrays and Generate Hash.

🔸 Example: one Regular Expression Match step with a pattern like [A-Z]{2}-\d{6} replaces several split and substring expressions for a ticket number such as AB-123456.

🎉 Result

Simple, fixed patterns stay in standard expressions. Variable patterns, multiple matches and regex replacements run in one connector action instead of long expression chains or loops.

🌟 Key Advantages

🔸 Regex in flows: match, batch match and replace with regular expressions, which the standard expressions don’t offer.

🔸 Fewer actions: one action instead of loops and nested expressions.

🔸 No extra service: the C# code runs as part of the custom connector, not on a server of the vendor.

🔸 Readable flows: an action called Extract Text Between Two Strings explains itself better than three nested split() calls.

⚠️ Good to Know

🔸 Licensing: custom connectors are premium. Every user who runs a flow with Power Tools needs a Power Automate premium license.

🔸 Limits of custom code: a custom code script must finish within 2 minutes, and the script file can’t exceed 1 MB.

🔸 Third-party product: support, updates and pricing come from the vendor. Check your organization’s rules for third-party connectors and DLP policies before you buy.

🛠️ FAQ

1. What is Power Tools?

A custom connector for Power Automate by Paul Murana. It uses the custom code feature of Power Platform connectors (C#) and adds text, regex, JSON and array actions.

2. Does my data leave my environment?

The vendor states that the connector is fully contained in your environment and sends no data to a third party. The C# code runs as part of the custom connector instead of calling an external service.

3. Is Power Tools a Microsoft product?

No. It is a third-party product by Paul Murana. Pricing and licensing are set by the vendor, see his website.

4. Can I do regex without a premium license?

Not with standard workflow expressions, they have no regex function. An Office Script in Excel can use JavaScript regex and is called with the standard Run script action, see #PowerPlatformTip 157.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy – live Power Platform workshops, free or CHF 49. Join the workshop waitlist to get notified about new dates. For companies that want this implemented for them, see KMUpower – Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.