You can use regular expressions in operations with the following library.
String | Description | Input | Output |
---|---|---|---|
String replaceFirst(String <input>, String
<regex>, String
<replacement>) where:
|
Replaces the first substring of the text string that matches the given regular expression with the given replacement. A null reference passed to this method is a no-op and returns null. |
|
|
String replaceAll(String <input>, String
<regex1>, String
<replacement1>, ..., String
<regexN>, String
<replacementN>) where:
Note:
The first pair of find-replace arguments are mandatory and the rest are optional. |
Replaces each substring of the text string that matches the given regular expression with the given replacement. You can use this for 1 or more find and replace options. The first pair of find-replace arguments are mandatory and the rest are optional. |
|
|
boolean matches(String <input>, String
<regex>) where:
|
Checks if the entire input string matches the regex pattern. If a null is passed as input, it returns false. |
#regex.matches('upper case', '([a-z]+)(
+)([a-z]+)') |
|
Array findAllMatches(String <input>, String
<regex>) where:
|
Find all matching substrings in the input string matching the regex pattern. |
#regex.findAllMatches('upper case AND lower case',
'([a-z]+)( +)([a-z]+)') |
["upper case", "lower case"] |