Showing results for 
Search instead for 
Did you mean: 

Support for regex - either in conditions or as an action with capture groups exposed

It would be really good to have support for regular expressions.


This could be surfaced in the UI ideally in both conditions and actions.


A conditional regex would just test whether a string matched against a regex.

An action regex would expose capture groups.

Status: Under Review

This is a great suggestion - we are trying to identify a way to safely run regex in Flow.

Advocate II

Hi @Stephen , MSFT,

Regex support is badly needed in Power Automate. I'm using Office Scripts (Excel online) for now. But I'm running into the 1600 quota very quickly (note: this limit is current as of 4/21/2022. Limits have been raised several times in the past. But it's still not enough). I'm currently processing a large number of purchase orders and validating part numbers. This solution isn't viable for a large enterprise like mine. 

Do you know when Regex support will be made available? If not, do you have any other suggestions/alternatives in the meantime? 


New Member

Coming up on five years to get this extremely useful and needed feature into the product. We pay extra for Power Automate so we can get some of the features for Azure DevOps that JIRA provides out of the box and we still can't do proper validation of form data!

Regular Visitor

The statement is "safely" run as the excuse why its missing. 🙄  I can only assume your referring to a ReDos. Which could be trapped in a number of ways. It still needs to be a tool available. See  Regular Expression Denial of Service if your never heard of ReDos.

Advocate II


One work around I came up with was to use an azure function. it's cheap and fast.

you can find some info online, or here on how to develop azure functions: Develop Azure Functions by using Visual Studio Code | Microsoft Docs


Here's an example class used as an azure function that strips non-printable characters using a regEx from a string:

using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;

namespace ValidatePartNumberRegEx
    public static class StripNonPrintableCharacters
        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
            log.LogInformation("StripNonPrintableCharacters HTTP trigger function processed a request.");

            string text = req.Query["text"];
            string regExPattern = "[^\\x20-\\x7E]"; // req.Query["regex"];
            Regex rx;
            String result = string.Empty;
            List<string> list = new List<string>();

                if ((regExPattern != null) && (text != null))
                    rx = new Regex(regExPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
                    string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
                    dynamic data = JsonConvert.DeserializeObject(requestBody);
                    text = text ?? data?.text;

                    MatchCollection matches = rx.Matches(text);
                    result = rx.Replace(text, "");
                    //matchCount = matches.Count;
                    // Report the number of matches found...
                    Console.WriteLine("{0} replaced with:\n{1} \nusing regex pattern: {2}",
                                      text, result, regExPattern);

                    // Report on each match.
                    //foreach (Match match in matches)
                    //    Console.WriteLine("Match: " + match.Value);
                    result = text;
                    Console.WriteLine("Error: The 'text' parameter is required. Please supply an input string value and try again. ");
            catch (Exception ex)
                result = text;
                Console.WriteLine("Exception occured due to: " + ex.Message);
            return new OkObjectResult(result);


Frequent Visitor

Hi Maxpower,  Yeah, Box55xvr posted the same solution (1 page back).


Kinda defeats the point of PowerApps tho. Surely you shouldn't need to drop into c# or similar just to pattern match. 


Marc posted one explanation about why this is a problem, but as he very rightly says it's not like it's an entirely unsolvable problem.  I wish MS would really make the explanation clear.