Start by working with each line, and use string.Split to break it into the three parts IP, date, and time:
string[] parts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 3)
{
string IP = parts[0];
string date = parts[1];
string time = parts[2];
...
}
Or use a Regex to extract the IP and the DateTime:
public static Regex regex = new Regex(
"^(?<IP>\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\s+(?<Date"+
">\\d\\d/\\d\\d/\\d{4})\\s+(?<Time>\\d\\d:\\d\\d:\\d\\d)",
RegexOptions.Multiline
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
...
Match m = regex.Match(line);
if (m.Success)
{
string IP = m.Groups["IP"].Value;
string date = m.Groups["Date"].Value;
string time = m.Groups["Time"].Value;
}
If you are going to play with regular expressions, then get a copy of
Expresso[
^] - it's free, and it examines and generates Regular expressions.