Designers > K2 Designer for Visual Studio > Design Tools > Inline Functions > Function Browser > Regular Expressions | Send feedback |
Regular Expressions provide a powerful, flexible, and efficient method for processing text. A regular expression is a pattern that the regular expression engine attempts to match in input text.
Fig. 1. Regular Expressions
An item is selected and then added to the canvas or K2 field part by clicking the Add button or by using drag-and-drop.
Functions | Description | Example |
---|---|---|
Match Multiple |
To match multiple values from the input string value using a regular expression pattern. e.g. Finding all claim codes in a text form that has “CLM” in front followed by a fixed 5 digit number. Input – Input text to search on. This is a String type. Regex Pattern – Regular Expression pattern to use for the search. Case Sensitive – Option to indicate whether the search should be case sensitive or not. Return value (String[]) - is the array of string values that matched the pattern. If there is no match, it returns “No match found”. |
Example 1: Example 2: Example 3: Example 4: |
Match Single |
To match a single value string from the input string value using a regular expression pattern. e.g. Finding a user’s name specified in a text form. Input – Input text to search on. This is a String type. Regex Pattern – Regular Expression pattern to use for the search. Case Sensitive – Option to indicate whether the search should be case sensitive or not. Expected When Empty – String type. This is returned when there is no match found or the matched value is empty. Return value (String) - is the matched string if there is a match. |
Example 1: Example 2: Example 3: Example 4: Example 5: |
Match |
For doing a regular expression pattern match of a value. e.g. to check if the input value is a valid E-mail address. Input – Input text to search on. This is a String type. Regex Pattern – Regular Expression pattern to use for the search. Case Sensitive – Option to indicate whether the search should be case sensitive or not. Return value (Boolean) - is true if a match was found, otherwise false. |
Example 1: Example 2: Example 3: Note that * will always return a match Example 4: Example 5: Matches words ending in 'es' Example 6: Matches words ending in 'es' |