public boolean checkRepeating ( String str ) { String pattern = "\\d+|\\d+-\\d+" ; if ( str . matches ( pattern ) ) { return true ; } return false ; }
method to validate the repeating section it can be a single number or a range