package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(\w+)\((?:[^()]+|(?R))*+\)`)
var str = `Attribute VB_Name = "mdl_WbkInits"
Option Compare Database
Function InitWbk_004(byRef wbkRef x ())
Dim wbk As wbk_004_InstoreBrief
Set wbk = New wbk_004_InstoreBrief
Call wbk.wbk_Init(wbkRef)
Set InitWbk_004 = wbk
End Function
Public Function InitWbk_003(ByRef wbkRef As Object) As Object
Dim wbk As wbk_003_3DCalculation
Set wbk = New wbk_003_3DCalculation
Call wbk.wbk_Init(wbkRef)
Set InitWbk_003 = wbk
End Function
`
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/