文件path处理
// replace /./ => /
pattern = /\/\.\//;
while (pattern.test(r)) {
r = r.replace(pattern, '/');
}
// replace ^./ => nothing
r = r.replace(/^\.\//g, '');
// replace /aa/../ => / (BUT IGNORE /../../)
pattern = /\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//;
while (pattern.test(r)) {
r = r.replace(pattern, '/');
}
// replace ^aa/../ => nothing (BUT IGNORE ../../)
r = r.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//, '');
邮箱
/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
分号分隔符的邮箱字符串
/^((([a-z0-9.-]+)@([\da-z.-]+)\.([a-z.]{2,6};))*(([a-z0-9.-]+)@([\da-z.-]+)\.([a-z.]{2,6})))$/