Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f1f14bea
authored
Jul 01, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复正则问题
parent
a5ce534a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
internal/logic/attr.go
internal/mapping/search_keyword.go
internal/logic/attr.go
View file @
f1f14bea
...
@@ -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
}
}
...
...
internal/mapping/search_keyword.go
View file @
f1f14bea
...
@@ -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.]|±|\+_|\+-|/|\(.*\)|\+/-|`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment