4

I want to verify a value in my azure logic app which follows a pattern which can be identified by Regular Expressions.

My Value is KUL-M-X-Y, here KUL is fixed value but value of M can be "KG", "TON" etc., also Value of X and Y can be numeric.

I searched for RegEx related expression in Logic apps but didn't find any.

Can any one suggest possible way to work with this?

dreftymac
  • 27,818
  • 25
  • 108
  • 169
Suraj Sahoo
  • 133
  • 1
  • 8
  • 3
    This is not a duplicate question. Here above I have specifically mentioned about use of RegEx in **Azure logic apps**, not in general. As of now Azure logic app does not provide direct use of RegEx expression. – Suraj Sahoo Nov 20 '19 at 02:29

1 Answers1

3

You can use inline code with Azure Logic Apps to handle regular expressions. I ran through the example and modified it to use the following regular expression:

/([K][U][L]-[a-zA-Z]{2,3}-\d\d)/g

You can then use a normal Condition step to check for existence of the results (if a match) or null if not:

enter image description here

Here is the code in the inline code step, for reference:

var reg = /([K][U][L]-[a-zA-Z]{2,3}-\d\d)/g;
var email = workflowContext.trigger.outputs.body.body;
return email.match(reg);
  • 6
    Except that to use the inline code action (which is still in preview, by the way) you have to have your logic app connected to an integration account. That integration account will cost you seveal thousand dollars per year to run on the basic plan. – Boschy Feb 13 '20 at 22:13