REMatch()
Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.
REMatch( regex=string, string=string, multiline=boolean );
Returns: Array
| Argument | Description | Default |
|---|---|---|
|
regex
string,
required
|
edit
Regular expression for which to search. Case sensitive. Alias: reg_expression |
|
|
string
string,
required
|
edit
String in which to search. |
|
|
multiline
boolean,
optional
|
edit
If true indicate the regular expression should treat input as having multiple lines. This option affects the interpretation of the ^ and $ metacharacters. When true the ^ metacharacter matches at the beginning of every line, and the $ metacharacter matches at the end of every line. Additionally the . metacharacter will not match newlines when true. Introduced: 5.3.8.23 |
false |
Usage Notes
editThe regex engine depends on the application settings (this.regex.type). Up to Lucee 8 the default is perl (Apache ORO), which is deprecated: Lucee 9 uses java as the default, see Regex Migration to Lucee 9.
Examples
edit
writeDump(REMatch('[a-z]+','AbcacAcdd'));
See also
- Strings
- Regex
- Java Regex Engine
- string.REMatch()
- Regex Migration to Lucee 9
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)