private void checkArgumentFormat ( CommandLineOption optionInfo , CharSequence matchedArg ) { // Check if this option enforces a format for its argument. if ( optionInfo . argumentFormatRegexp != null ) { Pattern pattern = Pattern . compile ( optionInfo . argumentFormatRegexp ) ; Matcher argumentMatcher = pattern . matcher ( matchedArg ) ; // Check if the argument does not meet its required format. if ( ! argumentMatcher . matches ( ) ) { // Create an error for this badly formed argument. parsingErrors . add ( "The argument to option " + optionInfo . option + " does not meet its required format.\n" ) ; } } }
Checks the format of an argument to an option against its specified regular expression format if one has been set . Any errors are added to the list of parsing errors .