regex - Difficulty with a Regular Expression C# -
i have line text file , i'm trying create regular expression match. line of text.
2015-01-07 wed jan 07 11:03:43.390 text here..
my regular expression match follows:
(?<date>(?<year>(?:\d{4}|\d{2})-(?<month>\d{1,2})-(?<day>\d{1,2})))\s(?<txtentry1>.*)\s(?<txtentry2>.*)\s(?<txtentry3>.*)\s(?<time>(?<hour>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2}):(?<milli>\d{0,3}))\s(?<txtentry4>.*)\s(?<txtentry5>.*))
it doesn't match. i'm not concerned 'worded' date wed jan 07 have left text entry, rather match yo dd/mm/yy. have been trying figure our no success. can see have gone wrong?
there 2 problems regular expression
there no pattern specified capture group(now updated)month
- you have used colon, instead of period separator between second , millisecond
(?<seconds>\d{2}):(?<milli>\d{0,3}))
Comments
Post a Comment