driver-core/src/main/com/mongodb/client/model/Filters.java
public static Bson regex(final String fieldName, final Pattern pattern) {
        notNull("pattern", pattern);
        return new SimpleEncodingFilter<Pattern>(fieldName, pattern);
    }
public static Bson regex(final String fieldName, final Pattern pattern) {
        notNull("pattern", pattern);
        return new SimpleEncodingFilter<Pattern>(fieldName, pattern);
    }
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given
options applied.

@param fieldName the field name
@param pattern   the pattern
@return the filter
@mongodb.driver.manual reference/operator/query/regex $regex