REgex to extract date and time
<p>I am using nltk regex for date and time extraction:</p>

<pre><code>text = 'LEts have quick meeting on Wednesday at 9am'
week_day = "(monday|tuesday|wednesday|thursday|friday|saturday|sunday)"
month = "(january|february|march|april|may|june|july|august|september| \
          october|november|december)"
dmy = "(year|day|week|month)"
exp2 = "(this|next|last)"
regxp2 = "(" + exp2 + " (" + dmy + "|" + week_day + "|" + month + "))"
reg2 = re.compile(regxp2, re.IGNORECASE)
found = reg2.findall(text)
found = [a[0] for a in found if len(a) &gt; 1]
for timex in found:
    timex_found.append(timex)

print timex_found
</code></pre>

<p>Everything looks right to me, but it does not tag <code>Wednesday</code> any clue? What change should I make to consider "wednesday" as well "this wednesday"</p>

<p>Will</p>

<pre><code>regxp2 = "((this|next|last)? (" + dmy + "| " + week_day + "| " + month+ "))"
</code></pre>

<p>consider my case?</p>

<p>The regex is looking for <code>((this|next|last) (dmy|weekday|month))</code>.</p>

<p>Your input doesn't have a match.</p>

<p>Some alternatives that may work:</p>

<pre><code>((this|next|last|on) (dmy|weekday|month))

((this|next|last)? (dmy|weekday|month))
</code></pre>

python regex