I have date time string t1
'Sat 02 May 2015 19:54:36 +0530' I want to extract the remove the first and last word, i.e. Sat and +0530. Here is the behavior of the three regex I wrote:
(1) re.search(r'(\d{2})([^:]+)([:\d{2}]+)',t1) matches '02 May 2015 19:54:36' (2) re.search(r'(\d{2})([^:]+)([:\d{2}]{2})',t1) matches '02 May 2015 19:5' (3) re.search(r'(\d{2})(.+)([\:\d{2}])',t1) matches '02 May 2015 19:54:36 +0530' Can someone explain what's the problem with number 2 and number 3? I thought all of these should yield the same result.