fn is_node_name_valid(_name: &str) -> Result<(), &str> {
	let name = _name.to_string();
	if name.chars().count() >= NODE_NAME_MAX_LENGTH {
		return Err("Node name too long");
	}

	let invalid_chars = r"[\\.@]";
	let re = Regex::new(invalid_chars).unwrap();
	if re.is_match(&name) {
		return Err("Node name should not contain invalid chars such as '.' and '@'");
	}

	let invalid_patterns = r"(https?:\\/+)?(www)+";
	let re = Regex::new(invalid_patterns).unwrap();
	if re.is_match(&name) {
		return Err("Node name should not contain urls");
	}

	Ok(())
}
/// Check whether a node name is considered as valid
Check whether a node name is considered as valid
Check whether a node name is considered as valid
fn is_node_name_valid(_name: &str) -> Result<(), &str> {
	let name = _name.to_string();
	if name.chars().count() >= NODE_NAME_MAX_LENGTH {
		return Err("Node name too long");
	}
	let invalid_chars = r"[\\.@]";
	let re = Regex::new(invalid_chars).unwrap();
	if re.is_match(&name) {
		return Err("Node name should not contain invalid chars such as '.' and '@'");
	}
	let invalid_patterns = r"(https?:\\/+)?(www)+";
	let re = Regex::new(invalid_patterns).unwrap();
	if re.is_match(&name) {
		return Err("Node name should not contain urls");
	}
	Ok(())
}
fn is_node_name_valid ( _name : & str ) -> Result < ( ) , & str > { let name = _name . to_string ( ) ; if name . chars ( ) . count ( ) >= NODE_NAME_MAX_LENGTH { return Err ( " " ) ; } let invalid_chars = r"[\\.@]" ; let re = Regex :: new ( invalid_chars ) . unwrap ( ) ; if re . is_match ( & name ) { return Err ( " " ) ; } let invalid_patterns = r"(https?:\\/+)?(www)+" ; let re = Regex :: new ( invalid_patterns ) . unwrap ( ) ; if re . is_match ( & name ) { return Err ( " " ) ; } Ok ( ( ) ) }
Check whether a node name is considered as valid
Check whether a node name is considered as valid
_name
&str
_name
&str