bson/src/main/org/bson/BSON.java
public static int regexFlags(final String s) {
        int flags = 0;

        if (s == null) {
            return flags;
        }

        for (final char f : s.toLowerCase().toCharArray()) {
            flags |= regexFlag(f);
        }

        return flags;
    }
public static int regexFlags(final String s) {
        int flags = 0;

        if (s == null) {
            return flags;
        }

        for (final char f : s.toLowerCase().toCharArray()) {
            flags |= regexFlag(f);
        }

        return flags;
    }
Converts a sequence of regular expression modifiers from the database into Java regular expression flags.

@param s regular expression modifiers
@return the Java flags
@throws IllegalArgumentException If sequence contains invalid flags.