Class RegexFilter


  • public class RegexFilter
    extends Filter
    Defines a regular expression filter
    Since:
    2.0
    • Method Detail

      • encode

        public void encode​(Mapper mapper,
                           org.bson.BsonWriter writer,
                           org.bson.codecs.EncoderContext context)
        Overrides:
        encode in class Filter
        Parameters:
        mapper - the mapper
        writer - the writer
        context - the context
      • options

        public RegexFilter options​(String options)
        Optional options to apply to the regex
        Parameters:
        options - the options
        Returns:
        this
      • pattern

        public RegexFilter pattern​(String pattern)
        The regular expression
        Parameters:
        pattern - the regular expression
        Returns:
        this
      • pattern

        public RegexFilter pattern​(Pattern pattern)
        The regular expression
        Parameters:
        pattern - the regular expression
        Returns:
        this
      • caseInsensitive

        public RegexFilter caseInsensitive()
        Case insensitivity to match upper and lower cases.
        Returns:
        this
      • extended

        public RegexFilter extended()
        “Extended” capability to ignore all white space characters in the $regex 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).

        Returns:
        this
      • multiline

        public RegexFilter multiline()
        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.
        Returns:
        this
      • special

        public RegexFilter special()
        Allows the dot character (i.e. .) to match all characters including newline characters.
        Returns:
        this