RegexFind constructor
RegexFind({
- required dynamic input,
- required dynamic regex,
- dynamic options,
Creates $regexFind operator expression
Provides regular expression (regex) pattern matching capability in
aggregation expressions. If a match is found, returns a document that
contains information on the first match. If a match is not found, returns
null.
MongoDB uses Perl compatible regular expressions (i.e. “PCRE” ) version 8.41 with UTF-8 support.
input- The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string.regex- The regex pattern to apply. Can be any valid expression that resolves to a string.options- Optional. The following -options- are available for use with regular expression:i- Case insensitivity to match both upper and lower cases. You can specify the option in the options field or as part of the regex field.m- For patterns that include anchors (i.e. ^ for the start, $ for the end), match at the beginning or end of each line for strings with multiline values. Without this option, these anchors match at beginning or end of the string. If the pattern contains no anchors or if the string value has no newline characters (e.g. \n), the m option has no effect.x- “Extended” capability to ignore all white space characters in the pattern unless escaped or included in a character class. Additionally, it ignores characters in-between and including an un-escaped hash/pound (#) character and the next new line, so that you may include comments in complicated patterns. This only applies to data characters; white space characters may never appear within special character sequences in a pattern. Thexoption does not affect the handling of the VT character (i.e. code 11).s- Allows the dot character (i.e. .) to match all characters including newline characters.
Implementation
RegexFind({required dynamic input, required regex, options})
: super('regexFind',
AEObject({'input': input, 'regex': regex, 'options': options}));