use regex::Regex;
use version::Identifier;
pub fn parse_meta(s: &str) -> Vec<Identifier> {
s.split(".")
.map(|part| {
if is_alpha_numeric(part) {
Identifier::AlphaNumeric(part.to_string())
} else {
Identifier::Numeric(part.parse().unwrap())
}
}).collect()
}
pub fn is_alpha_numeric(s: &str) -> bool {
lazy_static! {
static ref REGEX: Regex = Regex::new(r"^(0|[1-9][0-9]*)$").unwrap();
};
!REGEX.is_match(s)
}