You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
356 B
20 lines
356 B
2 years ago
|
package commons
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"regexp"
|
||
|
)
|
||
|
|
||
|
var jqueryJsonRegexp = regexp.MustCompile("\\d+\\((?P<json>.*?)\\)$")
|
||
|
|
||
|
func FilterJQueryPrefix(source string) string {
|
||
|
result := jqueryJsonRegexp.FindStringSubmatch(source)
|
||
|
|
||
|
if len(result) < 2 {
|
||
|
fmt.Errorf("jquery字段提纯失败,原字符串:", source)
|
||
|
return ""
|
||
|
} else {
|
||
|
return result[1]
|
||
|
}
|
||
|
}
|