Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • RegexFind

Index

Properties

Properties

$regexFind: { input: any; regex: string | RegExp; options?: RegexOptions }

Applies a regular expression (regex) to a string and returns information on the first matched substring.

version

4.2

see

https://docs.mongodb.com/manual/reference/operator/aggregation/regexFind/#mongodb-expression-exp.-regexFind

Type declaration

  • input: any

    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: string | RegExp

    The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options):

    • "pattern"
    • /pattern/
    • /pattern/options

    Alternatively, you can also specify the regex options with the options field. To specify the s or x options, you must use the options field.

    You cannot specify options in both the regex and the options field.

  • Optional options?: RegexOptions

    The following are available for use with regular expression.

    Note: You cannot specify options in both the regex and the options field.

    Option Description

    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. The x option does not affect the handling of the VT character (i.e. code 11). You can specify the option only in the options field.

    s Allows the dot character (i.e. .) to match all characters including newline characters. You can specify the option only in the options field.

Generated using TypeDoc