The downside to this method is that the “Run Script” action is currently in preview, and it is limited to 200 executions per day. I’ve also submitted an idea to allow execution of Javascript functions without the need for the Excel connector here, so I’d appreciate your vote on that idea. So please head over there and vote for it. An idea was submitted on the Power Automate Forum here in June 2019 to add Regular Expression support, but so far no support has been added. It also demonstrates the additional power that Office Scripts can add to Power Automate by providing access to JavaScript.īut I hope that support for regular expressions is added to the platform, string manipulation is a common requirement of many flows. This blog demonstrates that it is possible to add regex support to Power Automate for free, without the use of external connectors. Again, this is simple, I used this regex pattern: \d\d\d\d \d\d\d\d \d\d\d\d \d\d\d\d In this example scenario the string contains a credit card number, for security reasons the objective is to find the credit card number and replace it.
Expiry date is 06/2022 and the CVV is 342.
Power Automate already has a useful replace function, but without the ability to find matches first, it can be limited. Let matchArray: Array = searchString.match(re) įor (var i = 0 i < matchArray.length i++) Regular Expression Substitute with Power AutomateĪnother powerful function of regex is the search and replace function. Let re = new RegExp(regexPattern, regexFlags)
#Regular expression extractor online code
This is the code for the regexMatch function: function main If you’d like a demo of how this works, check out this video:Īs you can see, we get back a JSON array of results. So Excel Online can be used as a host for getting access to JavaScript functionality.
It’s possible to pass parameters into, and out of Office Scripts. So, as I said – there is no Regular Expression support within the standard Power Automate Actions, but there is regex support built into JavaScript, which can be accessed via Office Scripts in Excel Online.
#Regular expression extractor online how to
Third party connectors exist which can perform Regular Expressions on behalf of Power Automate, but this blog post will focus on how to execute regular expression actions for free, within Power Automate. This blog post will not go into great detail about how to use Regular Expressions, but simply how to execute them with Power Automate. Regular expressions are very useful for extracting and replacing information from any text by searching for one or more matches of a specific search pattern. Unfortunately, Power Automate does not have any support for Regular Expressions (regex or regExp), which can sometimes be very limiting, or make things which would be easy, quite complicated.