K2 BLACKPEARL PRODUCT DOCUMENTATION: USER GUIDE
Regular Expressions

Inline Functions - Regular Expressions

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:
Input: "example"
Pattern: "[a-z]*"
Case Sensitive: "true"
Result: {  "example" }

Example 2:
Input: "Example"
Pattern: "[a-z]*"
Case Sensitive: "true"
Result: { "xample" }

Example 3:
Input: "example"
Pattern: "[a-z]*"
Case Sensitive: false
Result: { "example" }

Example 4:
Input: "Example"
Pattern: "[a-z]*"
Result: { "Example" }

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:
Input: "Example"
Pattern: "[a-z]*"
Case Sensitive: true
Expected When Empty: "empty"
Result: "empty"

Example 2:
Input: "An example"
Pattern: "\\b\\w+es\\b"
Case Sensitive: true
Expected When Empty: "empty"
Result: "empty"

Example 3:
Input: "example;"
Pattern: "[a-z]*"
Case Sensitive: true
Expected When Empty: "empty"
Result: "example"

Example 4:
Input: "Example"
Pattern: "[a-z]*"
Case Sensitive: false
Expected When Empty: "empty"
Result: "Example"

Example 5:
Input: "example"
Pattern: "[a-z]*"
Expected When Empty: "empty"
Result: "example"

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:
Input: "Examples"
Pattern: "\\b\\w+es\\b"
Case Sensitive: true
Result: true

Example 2:
Input: "Example"
Pattern: "\\b\\w+es\\b"
Case Sensitive: true
Result: false

Example 3:
Input: ""
Pattern: "[a-z]*"
Case Sensitive: true
Result: true

Note that * will always return a match

Example 4:
Input: ""
Pattern: "[a-z]"
Case Sensitive: true
Result: false

Example 5:
Input: "Examples"
Pattern: "\\b\\w+es\\b"
Case Sensitive: false
Result: true

Matches words ending in 'es'

Example 6:
Input: "Example"
Pattern: "\\b\\w+es\\b"
Case Sensitive: false
Result: false

Matches words ending in 'es'

See Also

 

 


K2 blackpearl Help 4.6.10 (4.12060.1690.0)