code: @SuppressWarnings("deprecation")
  	protected int regexStrToFlags(String pattern) throws JsonParseException {
  		int flags = 0;
  		for (int i = 0; i < pattern.length(); ++i) {
  			char c = pattern.charAt(i);
  			switch (c) {
  			case 'i':
  				flags |= Pattern.CASE_INSENSITIVE;
  				break;
  				
  			case 'm':
  				flags |= Pattern.MULTILINE;
  				break;
  				
  			case 's':
  				flags |= Pattern.DOTALL;
  				break;
  				
  			case 'u':
  				flags |= Pattern.UNICODE_CASE;
  				break;
  				
  			case 'l':	
  			case 'x':
  				//unsupported
  				break;
  				
  			default:
  				throw new JsonParseException("Invalid regex", getTokenLocation());
  			}
  		}
  		return flags;
  	}
docs: Converts a BSON regex pattern string to a combined value of Java flags that
  can be used in {@link Pattern#compile(String, int)}
  @param pattern the regex pattern string
  @return the Java flags
  @throws JsonParseException if the pattern string contains a unsupported flag