Hello All,
I wish to share my expansion of a pretty nice Custom Connector by MattyBeard: PowerAutomate_CustomConnectors/RegexReplace at master · mattybeard/PowerAutomate_CustomConnectors (github.com)
Their specific connector only performs "replace". I expanded this idea and appended match and replace into one single connector with no authentication required. PowerAutomate_CustomConnectors/Alexanders RegEx (independent Publisher) at master · AlexanderWorley/PowerAutomate_CustomConnectors (github.com)
Keep in mind the function "matches" is not available through this, but you can use Apply To Each to emulate matches as long as your items are in the array format of ["object1","object2"]. If your list is set as a string you can use expressions like split and replace to brute force the list into the aforementioned array format. This is really handy for parsing multiple selections in MS Forms submissions!
example: To parse emails from a MS form submission from a Multiple selection question you can use this to export the function as the array then use the match function of the custom connector to iterate through all items!
Input text: "["test@test.com","test2@test.com","test3@test.com"]" (note the quotes as MS Forms exports the array as a string.... for some reason...)
(into the input of the apply to each) Expression input: split(replace(replace(replace(outputs('Compose'),']',''),'[',''),'"',''),',')
Output text:
[\\"test@test.com",\\"test2@test.com",\\"test3@test.com"]
Apply to Each:
(Selects email addresses)Match pattern: [A-Za-z0-9_]+@[A-Za-z0-9]+\.[A-Za-z]+
Append to Array variable: outputs(Alexander's_RegEx_Match)?['body/output']
Output: ["test@test.com","test2@test.com","test3@test.com"]
If you want to use this array for email automation purposes you can convert the array using the "join" action and having the "join with" field as a semicolon. ' ; '
I thought this was really neat and cool as other solutions either require an excel script OR annoyingly a subscription to 3rd party APIs.