package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)[^.]*(cervi(c|x)|C[1-7]|T[1-6]).*?\.(?=[^.]*L[1-5][^.]*\.)`)
var str = `There is a finding on T2 of spine. The finding is most likely fracture. Additionally, patient seems tired. In L2, patient has there is a circumferential disc bulge with Central disc herniation. In L5, patient seems to have another fracture. In the cervical spine, patient has any degeneration. Patient is may also have fever. L3, endplate edema is also found. In L5, patient may have bruise.`
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/