protected int convertMatchFlags ( Element opts ) { int flags = 0 ; String sopts = ( ( StringProperty ) opts ) . getValue ( ) ; for ( int i = 0 ; i < sopts . length ( ) ; i ++ ) { char c = sopts . charAt ( i ) ; switch ( c ) { case ' ' : flags |= Pattern . CASE_INSENSITIVE ; break ; case ' ' : flags |= Pattern . DOTALL ; break ; case ' ' : flags |= Pattern . MULTILINE ; break ; case ' ' : flags |= Pattern . UNICODE_CASE ; break ; case ' ' : flags |= Pattern . COMMENTS ; break ; default : throw EvaluationException . create ( sourceRange , MSG_INVALID_REGEXP_FLAG , c ) ; } } return flags ; }
A utility function to convert a string containing match options to the associated integer with the appropriate bits set .