From 76bb560aa30135fc8b959e1099fc1b437dccd836 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 21 Oct 2019 18:03:45 +0800 Subject: [PATCH] =?UTF-8?q?GetOneEmailFromStr=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 2 +- business/jxutils/jxutils_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index 1dd523dbe..763b78730 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -68,7 +68,7 @@ func init() { // Go regex does not support lookarounds. // https://stackoverflow.com/questions/38933898/error-parsing-regexp-invalid-or-unsupported-perl-syntax skuNamePat = regexp.MustCompile(`([\((\[【][^\((\[【\))\]】]*[\))\]】])?(.*?)([((].*[))])?\s*约?([1-9][\d\.]*)(g|G|kg|kG|Kg|KG|l|L|ml|mL|Ml|ML|克)\s*([((].*[))])?\s*(?:\/|/|)\s*([^\s()()]{0,2})\s*([((].*[))])?$`) - emailPat = regexp.MustCompile(`[A-Za-z0-9_\-\.]+@(?:[A-Za-z0-9_\-]+\.)+[A-Za-z]+`) + emailPat = regexp.MustCompile(`[A-Za-z0-9_\-.]+@(?:[A-Za-z0-9_\-]+\.)+[A-Za-z]+`) } func getJxStoreIDFromOrder(order *model.GoodsOrder) (retVal int) { diff --git a/business/jxutils/jxutils_test.go b/business/jxutils/jxutils_test.go index 2e1f22a93..55a78db84 100644 --- a/business/jxutils/jxutils_test.go +++ b/business/jxutils/jxutils_test.go @@ -274,6 +274,10 @@ func TestGetOneEmailFromStr(t *testing.T) { "test@kk.com", "中人国test@kk.com2342", }, + []string{ + "donald.trump_1-3@163.com", + "中人国donald.trump_1-3@163.com2342", + }, } { if str := GetOneEmailFromStr(v[1]); str != v[0] { t.Errorf("%s failed, result:%s, expect:%s", v[1], str, v[0])