package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<![\u4E00-\u9FAF\u3040-\u3096\u30A1-\u30FA\uFF66-\uFF9D\u31F0-\u31FF])(?<!\d)(?<!\d\.)(\d+(?:\.\d+)?m2)`)
var str = `"110.94m2・129.24m2";
--> 110.94m2 and 129.24m2
"81.95m2(24.78坪)、うち2階車庫8.9m2"
--> 81.95m2
"80.93m2(登記)"
--> 80.93m2
"93.42m2・93.85m2(登記)"
--> 93.42m2 and 93.85m2
"81.82m2(実測)"
--> 81.82m2
"81.82m2(実測)、うち1階車庫7.82m2"
--> 81.82m2
"90.11m2(実測)、うち1階車庫8.07m2"
--> 90.11m2`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/