fusion-common 0.1.0

A data fusion platform with scheduler, ai agent studio and core libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use regex::Regex;

static REGEX_EMAIL: &str = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$";

static REGEX_PHONE_ON_CHINA: &str = r"^1[3-9]\d{9}$";

/// 校验邮件地址是否有效.
pub fn is_email(email: &str) -> bool {
  let re = Regex::new(REGEX_EMAIL).unwrap();
  re.is_match(email)
}

/// 校验手机号地址是否有效。
pub fn is_phone(phone: &str) -> bool {
  let re = Regex::new(REGEX_PHONE_ON_CHINA).unwrap();
  re.is_match(phone)
}