<commit_before>// valid names must be alphanumberic or underscores between 4 and 25 characters (cannot start with underscore)
const validNames = /^[a-zA-Z0-9][a-zA-Z0-9_]{3,24}$/;

/** @private */
export function toUserName(channel: string): string {
	// it's okay if this is already a user name, we only remove the first character if it's a pound
	const name = channel.replace(/^#/, '').toLowerCase();
	if (!validNames.test(name)) {
		throw new Error(
			'"${name}" is not a valid user or channel name. It must be 4-25 characters long, can only include letters, numbers and underscores, and can not start with an underscore.'
		);
	}
	return name;<commit_msg>ACTUALLY fix typo in toUserName error message<commit_after>// valid names must be alphanumberic or underscores between 4 and 25 characters (cannot start with underscore)
const validNames = /^[a-zA-Z0-9][a-zA-Z0-9_]{3,24}$/;

/** @private */
export function toUserName(channel: string): string {
	// it's okay if this is already a user name, we only remove the first character if it's a pound
	const name = channel.replace(/^#/, '').toLowerCase();
	if (!validNames.test(name)) {
		throw new Error(
			`"${name}" is not a valid user or channel name. It must be 4-25 characters long, can only include letters, numbers and underscores, and can not start with an underscore.`
		);
	}
	return name;
{'fraction_non_alphanumeric': 0.12130177514792899, 'fraction_numerical': 0.019230769230769232, 'mean_word_length': 4.144486692015209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735128', 'n_tokens_mistral': 443, 'n_tokens_neox': 408, 'n_words': 177}