package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`.+left X:..(.+?)\n.+Y:..(.+?)\n.+\n.+\n.+:.(.+?)\n.+:.(.+?)\n`)
var str = `
xwininfo: Window id: 0x4800024 "Yebe"
Absolute upper-left X: 100
Absolute upper-left Y: 164
Relative upper-left X: 10
Relative upper-left Y: 45
Width: 1600
Height: 1200
Depth: 24
Visual: 0x6e
Visual Class: DirectColor
Border width: 0
Class: InputOutput
Colormap: 0x4800022 (not installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +100+164 -860+164 -860-76 +100-76
-geometry 1600x1200+90-66`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
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/