Returns the number of matches for the regular expression pattern on the entity property value.
Target parameters (in) and Activity options
The entity used for the property value.
The property for the value to count matches on.
The regular expression patterns. You can write more than one pattern by using “#REGEX#” as delimiter between them.
The pattern is used in the C# Regex class see Regex Class (System.Text.RegularExpressions) | Microsoft Docs.
Source parameters (out)
The number of matches for all given patterns.
As a developer you might want to validate user entered values in a field. Such as email addresses so it does not include faulty characters, and that the structure of the email looks correct.
You can use the "Regular Expression" to do this. We can look at this example below:
In my workflow that edits one of my entities called "Customer" I have a field called email. When a user has edit this value I want to check that the values are correct.
- Place "Regular Expression Activity" after the dialog view in the process
- Make sure that the newly added activity is before the "Commit"
- Bind the entity to the regular expression
- Click on "Regular Expression"
- Select the email property
- Paste this the value below into the "Pattern"
Adjust the "Commit"
- Add a criteria on incoming branch to the "Commit" activity.
- [MatchCount] = 1
- If the entered value matches our pattern/expression and the workflow will commit
Show a waring message if value is faulty
- Drag a "Show message Box" and drop it on the "Regular Expression" activity.
- Edit some informational text into the Message Box.
- Add an additional branch, by pressing "Add Branch"
- Select the "Dialog View" (Edit) as "Sourcestep"
- Save the workflow and verify that the newly added function works as supposed.