| Explanation | Compile the regular expression to create a RegexPattern object.This method is a static method. You can call it without creating an object.
|
| Call format | var rp = RegexPattern.Compile( regex [, flags [, mode ]] ) |
| Return value | RegexPattern object |
| Arguments | String regex | Regular expressions Since Ver.5.0.1, it is treated as UString type in Unicode mode |
| integer flags | Match flag Specify a combination of the following values. | Constant | Value | Description | RegexPattern.CASELESS RegexPattern.CASE_INSENSITIVE | 1 | Performs case-insensitive matching | | RegexPattern.MULTILINE | 2 | The metacharacters "^" and "$" will now match relative to the newline code ( "\n" ). | | RegexPattern.DOTALL | Four | The metacharacter "." Will now match all characters, including newlines | RegexPattern.EXTENDED RegexPattern.COMMENTS | 8 | Whitespace is ignored and lines starting with # are ignored as comments until the end of the line | | RegexPattern.ANCHORED | 16 16 | Limited to match only from the beginning | | RegexPattern.DOLLAR_ENDONLY | 32 | The metacharacter "$" will now match only at the end of the searched string | | RegexPattern.UNGREEDY | 512 | Make repeat specifiers ungreedy by default | If omitted, it is 0 (not specified). |
| integer mode | If you want to generate the regular expression engine in Unicode mode , specify RegexPattern.Unicode. If omitted, it is 0 (normal mode). Added since Ver.5.0.1 |
| Exception | Func 4 | The argument value is invalid |
| Example of use |
var p = RegexPattern.Compile("Biz/([a-zA-Z]+)", RegexPattern.CASELESS, RegexPattern.Unicode);
var m = p.Matcher("Biz/Browser");
if (m.Matches()) {
print(m.Group(1), "\n");
}
|
| Related item | Matches method |