String patterns
Common patterns
| Pattern | Description | Example |
|---|---|---|
pattern for a number |
Matches Java™-style double values. | set decision to "Number: 123!" extracting the first string matching the pattern for a number
Expected output: "123" |
pattern for a number using locale
<string> |
Matches a number that is formatted by using the given locale. | set decision to "Prix: 999,99 euros" extracting the
first string matching the pattern for a number using locale "fr-FR"
Expected output: "999,99" |
pattern for a number using
<string> |
Matches a number by using a string format. The locale is "en-US". |
set decision to "Prix: 999,99 euros" extracting the first
string matching the pattern for a number using "##,#;(#)"
Expected output: "999,99" |
pattern for a number using locale <string> and
<string> |
Matches a number by using both locale and string format. | set decision to "Solde: (999,99) euros" extracting the
first string matching the pattern for a number using locale "fr-FR" and "##,#;(#)"
Expected output: "(999,99)" |
pattern for a boolean |
Matches Java Boolean values. | set decision to "b = true;" extracting the first string matching the pattern for a boolean
Expected output: "true" |
Date and time patterns
| Pattern | Description | Example |
|---|---|---|
|
Matches ISO format for date, date & time, universal date & time, or time. | set decision to "Date: 2025-02-14" extracting the
first string matching the pattern for a date
Expected output: "2025-02-14" |
|
Matches ISO format for date, date & time, universal date & time, or time, by using the specified locale. | set decision to "Date: 2025-02-14" extracting the
first string matching the pattern for a date & time using locale "fr-FR"
Expected output: "2025-02-14" |
|
Matches date, date & time, universal date & time, or time by using the specified
string format. The locale is "en-US". |
set decision to "Date: 2/14/25" extracting the
first string matching the pattern for a date using "M/d/yy";
Expected output: "2/14/25" |
|
Matches date, date & time, universal date & time, or time by using both locale and string format. | set decision to "Date: 2/14/25" extracting the
first string matching the pattern for a date using locale "en-US" and "M/d/yy";
Expected output: "2/14/25" |
Email and URL matching patterns
| Pattern | Description | Example |
|---|---|---|
pattern for an email |
Matches email addresses. | set decision to "His e-mail is john@example.com."
extracting the first string matching the pattern for an email;
Expected output: "john@example.com" |
pattern for a URL |
Matches URLs (with or without protocol) and IP addresses. | set decision to "The link to our site is ibm.com."
extracting the first string matching the pattern for a URL;
Expected output: "ibm.com" |
Plain text matching patterns
| Pattern | Description | Example |
|---|---|---|
|
|
Matches multiple or optional space separator characters. |
set decision to "A\n\tB \n C" divided into parts by the
pattern for space separators
Expected output: { "A", "B", "C" } |
set decision to "A,B, C" divided into parts by "," +
the pattern for optional space separators
Expected output: { "A", "B", "C" } |
||
pattern for a text line
|
Matches each line excluding end-of-line characters. |
set decision to "ABC\n\nD\n" extracting all strings matching
the pattern for a text line
Expected output: { "ABC", "", "D" } |
|
|
Matches lines containing (or not containing) the string or phrase. Phrase variants match whole words. |
set decision to "AB\nBC\nCD\nDE" extracting all strings
matching the pattern for a text line containing "C"
Expected output: { "BC", "CD" } |
set decision to "AB\nBC\nCD\nDE" extracting all
strings matching the pattern for a text line not containing "C"
Expected output:{ "AB", "DE" } |
||
|
|
Matches text before a string. Word-delimited variants match whole words. |
set decision to "A or B or C" extracting the first string
matching the pattern for the text before " or "
Expected output:"A" |
set decision to "A or B or C" extracting the first
string matching the pattern for the text before the last occurrence of " or "
Expected output:"A or B" |
||
|
|
Matches text after a string. Word-delimited variants match whole words. |
set decision to "A or B or C" extracting the first string
matching the pattern for the text after " or "
Expected output:"B or C" |
set decision to "A or B or C" extracting the first
string matching the pattern for the text after the last occurrence of " or "
Expected output: "C" |
||
|
|
Matches text between two strings. Word-delimited variants match whole words. |
set decision to "John ran 10 miles, Peter ran 12 miles"
extracting all strings matching the pattern for the text after "ran" and before
"miles"
Expected output:{ " 10 ", " 12 " } |
set decision to "json: { \"a\": { \"b\": 123 } }"
extracting the first string matching the pattern for the text after "{" and before the last
occurrence of "}"
Expected output:" \"a\": { \"b\": 123 } " |
||
set decision to "<doc><value
type='int'>123</value><tag/></doc>" extracting the first string matching the
pattern for the text after ">" and before the last occurrence of "</"
Expected output:"<value type='int'>123</value><tag/>" |
||
set decision to "makeup make retake make take
mistakes" extracting the first string matching the pattern for the word-delimited text after
"make" and before the last occurrence of "take"
Expected output:" retake make " |
CSV patterns
| Pattern | Description | Example |
|---|---|---|
pattern for a CSV value |
Matches values between commas in a CSV string. | set decision to "1997,Ford,,E350,\"Super,
\"\"luxurious\"\" truck" extracting all strings matching the pattern for a CSV value
Expected output: { "1997", "Ford", "", "E350", "\"Super, \"\"luxurious\"\" truck" } |
pattern for a CSV separator |
Matches the separators in a CSV string. | set decision to "1997,Ford,,E350,\"Super,
\"\"luxurious\"\" truck" divided into parts by the pattern for a CSV separator;
Expected output: { "1997", "Ford", "", "E350", "\"Super, \"\"luxurious\"\" truck" } |
Markdown patterns
| Pattern | Description | Example |
|---|---|---|
pattern for a markdown code
block |
Matches text of a markdown-style code block. | set decision to "Code:\n `\n A + B\n `" extracting all
strings matching the pattern for a markdown code block;
Expected output: { "```\n A + B\n ```" } |
set decision to "Code:\n `\nA + B\n `" extracting all
strings matching the pattern for a markdown code block;
Expected output: { } |