Commit f1f14bea by mushishixian

修复正则问题

parent a5ce534a
...@@ -164,9 +164,11 @@ func splitAttrs(attrs string) (result []string) { ...@@ -164,9 +164,11 @@ func splitAttrs(attrs string) (result []string) {
//提取参数 //提取参数
func extractAttr(attr string) []string { func extractAttr(attr string) []string {
fmt.Println(attr)
regexpUnit := strings.Join(getNeedCheckUnit(), "|") regexpUnit := strings.Join(getNeedCheckUnit(), "|")
r, _ := regexp.Compile("$(\\d+[\\/\\d. ]*|\\d)(" + regexpUnit + ")" + "") r, _ := regexp.Compile("(\\d+[\\/\\d. ]*|\\d)(" + regexpUnit + ")" + "")
res := r.FindAllString(attr, 100) res := r.FindAllString(attr, 100)
fmt.Println(res)
return res return res
} }
......
...@@ -13,8 +13,8 @@ var KeywordRegular = map[string]string{ ...@@ -13,8 +13,8 @@ var KeywordRegular = map[string]string{
`(Pf|PF|pf)$`: "pF", `(Pf|PF|pf)$`: "pF",
`(Mf|MF|mf)$`: "mF", `(Mf|MF|mf)$`: "mF",
`(Uh|uh|μh|uH|UH)$`: "μH", `(Uh|uh|μh|uH|UH)$`: "μH",
`K$`: "nF", `(K)$`: "nF",
`v$`: "V", `(V|v)`: "V",
} }
var PureNumberRegular = `(\d+(\.\d+)?)` var PureNumberRegular = `(\d+(\.\d+)?)`
var GetAttrUnitRegular = `[\d.]|±|\+_|\+-|/|\(.*\)|\+/-|` var GetAttrUnitRegular = `[\d.]|±|\+_|\+-|/|\(.*\)|\+/-|`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment