bson/src/main/org/bson/BSON.java
public static int regexFlag(final char c) {

        int flag = FLAG_LOOKUP[c];

        if (flag == 0) {
            throw new IllegalArgumentException(String.format("Unrecognized flag [%c]", c));
        }

        return flag;
    }
public static int regexFlag(final char c) {

        int flag = FLAG_LOOKUP[c];

        if (flag == 0) {
            throw new IllegalArgumentException(String.format("Unrecognized flag [%c]", c));
        }

        return flag;
    }
Converts a regular expression modifier from the database into Java regular expression flags.

@param c regular expression modifier
@return the Java flags
@throws IllegalArgumentException If sequence contains invalid flags.