I'm trying to split big file with some regex. Problem is that I want to keep delimiter in text after split, and I tried to add ?= on the beggining of regex, but then it doesn't split. I tried modified regex in Sublime, and it's working there.
Text is like this:
Aug 07, 2014 01:01:01 PM
some text
Aug 07, 2014 02:02:02 PM
So, date, then some text and date. I want to get split text with regex which recognize that date.
First version of regex, which works perfectlly for my purpose:
\w{3}\s\d{2}\,\s\d{4}\s\d{1,2}\:\d{2}\:\d{2}\s[AM|PM].)
Code in Python is this:
allparts = re.compile(r'\w{3}\s\d{2}\,\s\d{4}\s\d{1,2}\:\d{2}\:\d{2}\s[AM|PM].').split(alltext)
After adding ?=, it looks like this:
allparts2 =re.compile(r'(?=\w{3}\s\d{2}\,\s\d{4}\s\d{1,2}\:\d{2}\:\d{2}\s[AM|PM].)').split(alltext)
What I'm doing wrong in second code?