package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`Connection reset.*?\b([^ .]+\.xls)\b`)
var str = `ava.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:197) at jcifs.netbios.SessionServicePacket.readPacketType(SessionServicePacket.java:68) at jcifs.netbios.NbtSocket.connect(NbtSocket.java:107) at jcifs.netbios.NbtSocket.(NbtSocket.java:68) at jcifs.smb.SmbTransport.ensureOpen(SmbTransport.java:275) at jcifs.smb.SmbTransport.send(SmbTransport.java:602) at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:847) at jcifs.smb.SmbTree.treeConnect(SmbTree.java:119) at jcifs.smb.SmbFile.connect(SmbFile.java:790) at jcifs.smb.SmbFile.connect0(SmbFile.java:760) at jcifs.smb.SmbFile.queryPath(SmbFile.java:1149) at jcifs.smb.SmbFile.exists(SmbFile.java:1232) at com.ssc.faw.util.SmbFileOperator.copyFile(Unknown Source) at com.ssc.faw.newnav2faw.FundList.checkFiles(Unknown Source) at com.ssc.faw.newnav2faw.FundList.buildList(Unknown Source) at com.ssc.faw.newnav2faw.Process.buildFundList(Unknown Source) at com.ssc.faw.job.NavToFaw.runNav2Faw(Unknown Source) at com.ssc.faw.job.NavToFaw.runNav2Faw(Unknown Source) at com.ssc.faw.job.NavToFaw.runJob(Unknown Source) at com.ssc.faw.job.NavToFaw.main(Unknown Source) [WARN ] 2015-05-05 21:02:26,383 Caught an Exception for file \ac_asd_2.my_web.com\global\nvice\alert\ filename abcd123.xls continuing to process other funds 0 : null jcifs.smb.SmbException: An error occured sending the request.`
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/