using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"Connection reset.*?\b([^ .]+\.xls)\b";
string input = @"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.";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx