I want to achieve the effect of
the following
[江苏省(320000)|PROV|0|][苏州市(320500)|CITY|0|][吴江区(320509)|AREA|0|][双板桥路()|ROAD|1|52号$]附近
Convert:
江苏省苏州市吴江区双板桥路52号附近
Here is the correct code for golang
reg := regexp.MustCompile("\\[([^\\(]+)\\(\\d*\\)\\|\\w*\\|\\d\\|([^\\]\\$]*)\\$?\\]")
fmt.Println(dis.Address)
dis.Address = reg.ReplaceAllString(dis.Address, "$1$2")
fmt.Println(dis.Address)
The following code is the same effect and grammar, syntax, and the main difference in regexbuddy golang of: a plurality escape character to \
\[([^\(]+)\(\d*\)\|\w*\|\d\|([^\]\$]*)\$?\]
Summarized as follows
- Normal expression \ w is able to identify the Chinese, but does not seem to be golang, need [\ u4e00- \ u9fa5] specified display
- golang use the escape character \\
- \ W \ d but also with other commonly represented \\ w \\ d
- regexp.MustCompile ( ``) to try such an approach remains to be