|
@@ -463,8 +463,8 @@ func getKvByLuaFields(extfrom string, j *ju.Job, in *RegLuaInfo, t map[string][]
|
|
|
}
|
|
|
|
|
|
//正则提取结果
|
|
|
-func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[string]interface{} {
|
|
|
- extinfo := map[string]interface{}{}
|
|
|
+func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[string][]map[string]interface{} {
|
|
|
+ extinfo := map[string][]map[string]interface{}{}
|
|
|
if v.RegCore.Bextract { //正则是两部分的,可以直接抽取的(含下划线)
|
|
|
apos := v.RegCore.Reg.FindAllStringSubmatchIndex(text, -1)
|
|
|
if len(apos) > 0 {
|
|
@@ -475,7 +475,8 @@ func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[stri
|
|
|
continue
|
|
|
}
|
|
|
val := text[pos[p]:pos[p+1]]
|
|
|
- extinfo[k] = map[string]interface{}{
|
|
|
+ tmps := []map[string]interface{}{}
|
|
|
+ tmp := map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
|
"ruletext": v.RuleText,
|
|
@@ -484,6 +485,8 @@ func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[stri
|
|
|
"type": "regexp",
|
|
|
"matchtype": "regcontent",
|
|
|
}
|
|
|
+ tmps = append(tmps, tmp)
|
|
|
+ extinfo[k] = tmps
|
|
|
if val != "" {
|
|
|
if j.Result[v.Field] == nil {
|
|
|
j.Result[k] = [](*ju.ExtField){}
|
|
@@ -496,7 +499,8 @@ func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[stri
|
|
|
} else {
|
|
|
val := v.RegCore.Reg.ReplaceAllString(text, "")
|
|
|
if val != "" {
|
|
|
- extinfo[v.Field] = map[string]interface{}{
|
|
|
+ tmps := []map[string]interface{}{}
|
|
|
+ tmp := map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
|
"ruletext": v.RuleText,
|
|
@@ -505,6 +509,8 @@ func extRegCoreToResult(extfrom, text string, j *ju.Job, v *RegLuaInfo) map[stri
|
|
|
"type": "regexp",
|
|
|
"matchtype": "regcontent",
|
|
|
}
|
|
|
+ tmps = append(tmps, tmp)
|
|
|
+ extinfo[v.Field] = tmps
|
|
|
if j.Result[v.Field] == nil {
|
|
|
j.Result[v.Field] = [](*ju.ExtField){}
|
|
|
}
|