parsing - Setup -match statement -
i'm trying setup -match statement based on number of conditions.
these conditions: lines contain holiday date follow these rules.
- they contain text "title", followed by
- one or more of character, followed by
- the text "when: " (note trailing space), followed by
- three "word" characters , space, followed by
- the date in "dd mmm yyyy" format (i.e., "31 dec 2012”), followed by
- a character not space, "word" or "digit"
the characters match underlined bullet point ones need extracted, converted [datetime] value, , returned caller.
a sample of data based on holiday dates. focus line in bold.
<br />event status: confirmedhttp://www.google.com/calendar/event?eid=mjaxntaymtrfnjbvmzbkcjq2c28zmgmxzzywbzmwzhi0y28gdxnhx19lbkbo' title='alternate'/>http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic/20150214_60o30dr46so30c1g60o30dr4co'/>holidays in united stateshttp://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic/20140214_60o30dr46so30c1g60o30dr4ck2014-03-24t19:02:40.000z2014-03-24t19:02:40.000zhttp://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/>valentine's daywhen: fri 14 feb 2014<br><br>who: holidays in united states
this have far: 'title.*when:\s+(\w{1,3})\s(?<date>)(?\s\w\d)'
i error:
parsing "title.*when:\s+(\w{1,3})\s(?<date>)(?\s\w\d)" - unrecognized grouping construct. @ d:\test.ps1:9 char:8 + if ( $_ -match 'title.*when:\s+(\w{1,3})\s(?<date>)(?\s\w\d)') + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : operationstopped: (:) [], argumentexception + fullyqualifiederrorid : system.argumentexception
what have done wrong?
i think went off rails here:
(?<date>)(?\s\w\d) a named group construct (? followed regex , closing paren:
(?<date>?\s\w\d)
Comments
Post a Comment