private int tryCobolWord(final String text, final int start,
			final int length) {
		boolean sawLetter = false;
		int lastLetterOrDigit = start - 1;

		int position = start;
		while (position < length) {
			final char c = text.charAt(position);

			if (isLetter(c)) {
				sawLetter = true;
				lastLetterOrDigit = position;
				position += 1;
				continue;
			}

			if (isDigit(c)) {
				lastLetterOrDigit = position;
				position += 1;
				continue;
			}

			if (c == '-' || c == '_') {
				// Enterprise COBOL for z/OS, Version 4 Release 2, allows
				// underscores as part of user defined words. See
				// http://publibfp.boulder.ibm.com/epubs/pdf/c2386120.pdf .
				// (With thanks to Peter Tang for finding this.)
				position += 1;
				continue;
			}

			// Not a legal Cobol word character.
			break;
		}

		if (position == start || !sawLetter) {
			// No match.
			return 0;
		}

		// Matched something with at least one letter.
		return lastLetterOrDigit - start + 1;
	}