Jan 08 2020 08:25 PM
Jan 08 2020 08:25 PM
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?
Jan 08 2020 10:10 PM - edited Jan 08 2020 10:13 PM
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.
Jan 08 2020 10:22 PM
Hi again @lfkentwell
Further to my last message, here's a screen shot of the process I was describing.
Jan 09 2020 01:05 PM
@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.
Jan 09 2020 02:58 PM
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.