Some string:
s = 'some text some text date may 04 at 05 AM some text some text'
I've written the regex to extract date from the above like below:
m = re.search(r'date ([a-z]{3} [0-9]{2}) at ([0-9]{2}) ([P][M])|date ([a-z]{3} [0-9]{2}) at ([0-9]{2}) ([A][M])', s)
Is it possible to write this regex in some shorter way or can '|' character be used in a better way than this? Because the above regexps are only different at 'AM' and 'PM' part. I just don't feel right using this regex.
|inside a character class.[A|P]matchesA,|orP.