private static int nextIndex( String description, int defaultIndex ) {

        Pattern startsWithNumber = Pattern.compile( "(\\d+).*" );
        Matcher matcher = startsWithNumber.matcher( description );
        if( matcher.matches() ) {
            return Integer.parseInt( matcher.group( 1 ) ) - 1;
        }

        return defaultIndex;
    }
Returns the next index of the argument by decrementing 1 from the possibly parsed number

@param description this String will be searched from the start for a number
@param defaultIndex this will be returned if the match does not succeed
@return the parsed index or the defaultIndex
jgiven-core/src/main/java/com/tngtech/jgiven/report/model/StepFormatter.java