Using regex to match a sting in a replace function

Brass Contributor

Hoping someone can help me with an issue.  I have some text that comes from an RSS feed that I post to Yammer using Flow.  The source randomly includes text between square brackets.  The text is different but it's always between squire brackets


e.g. Reconsider your need to travel [/consular-services/travel-advice-explained] due...


I want to simply remove the text in the square brackets along with the brackets.  If I use a replace and "hard" code the string to remove (string2 in the replace function) it works fine e.g. the expression that works is below.


replace(variables('String'),'[/consular-services/travel-advice-explained] ','New Text')


However if I try to use a regex that looks for anything between square brackets in place of the "hard" coded string it fails.  I know your going to say i need to escape the square brackets I am aware of this and tried a few different combinations.  I even tested the expressions on various regex test tools and the expression matches but not in Flow.


examples of regex strings i tried are below.  They all work in the various regex testing tools and websites but Flow doesn't work.







Is there a special way to use a regex in a replace expression?

Are regex even supported in a replace expression?

Am I missing something?



5 Replies

Hi @lfkentwell 


RegEx has some limited support in Plumsail and AquaForest PDF connectors, but nothing else that I can see.


Perhaps the easiest workaround is to pass the RSS feed output through Excel Online and use this formula to remove the brackets and text between.




So basically have the RSS feed output inserted into cell A1 and the formula can be in A2. 


The formula then removes the bracketed info and you can retrieve the result of A2 and pass it to Yammer.


A few extra steps but you'll get the result.


Hopefully that gives you something to play with?





EDIT: Forgot to mention, make A1 and A2 into a table as the Excel connector will need to reference it.

Hi again @lfkentwell 


Further to my last message, here's a screen shot of the process I was describing.






@Damien Rosario thanks for the input.  After literally wasting half a day trying to get regex to work i found one entry in Google that appears to indicate regex is not supported natively.  Can't imagine why its not but there you go.


Thanks for your suggestion I was able to get it to work within Flow using splits and concatenates its just 8 steps long which seem crazy when it could be done in one replace if only regex was supported.

Hi @lfkentwell 


Yup, not currently supported which is a shame.


Yeah the workaround you mentioned, or mine, etc are the way to go for now. It gets a result!


Best wishes with your Power Automate work.






@Damien Rosario Appreciate the support.