I'm trying to do a fun little project (and hopefully learn a bit as well) and I'm hitting a wall with regex.
I created and validated a rather long regular expression to validate a line in one bit call using
Regexdemo A portion of the line I want to parse should look like this
[Wed Oct 11 23:56:26 2006] John purchased, but to keep it simple, I'll only deal with the day of the week and month of the year.
I'm using the following expression
\\[(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) I get no matches with this statement. OTOH, if I just use
\\[(Mon|Tue|Wed|Thu|Fri|Sat|Sun) it finds every line.
I've tried using
\s instead of hardcoding the space (though I'd rather just have the space), and that fails.
I've tried this by scanning a file and I've tried reading a line into a
string and then scanning the string, but it always fails.
Below is a code snippet. FWIW, I'm fairly certain I can break this up into seperate scans (first the bracket/day of week, then month of year and so on), and in some ways, that's probably the correct way to do it, but I want to know why this doesn't work.
As always, your input is greatly appreciated.
Kevin