Class RegexFilter
- java.lang.Object
-
- dev.morphia.query.experimental.filters.Filter
-
- dev.morphia.query.experimental.filters.RegexFilter
-
public class RegexFilter extends Filter
Defines a regular expression filter- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegexFilter
caseInsensitive()
Case insensitivity to match upper and lower cases.void
encode(Mapper mapper, org.bson.BsonWriter writer, org.bson.codecs.EncoderContext context)
RegexFilter
extended()
“Extended” capability to ignore all white space characters in the $regex pattern unless escaped or included in a character class.RegexFilter
multiline()
For patterns that include anchors (i.e.RegexFilter
options(String options)
Optional options to apply to the regexRegexFilter
pattern(String pattern)
The regular expressionRegexFilter
pattern(Pattern pattern)
The regular expressionRegexFilter
special()
Allows the dot character (i.e.-
Methods inherited from class dev.morphia.query.experimental.filters.Filter
entityType, getField, getName, getValue, getValue, isNot, isValidating, not, path, toString, writeNamedValue, writeUnnamedValue
-
-
-
-
Method Detail
-
encode
public void encode(Mapper mapper, org.bson.BsonWriter writer, org.bson.codecs.EncoderContext 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
-
-