-1

I need to extract out this text "start_time":"2018-08-05T17:41:29.933Z" form this string:

BLAH text BLAH text "start_time":"2018-08-05T17:41:29.933Z" blah TEXT BLAH text

I tried this: \[\"start_time\":\"(.*)\"\]

But it did not work. What am I missing here?

Thanks!

Kenobi
  • 465
  • 6
  • 13
  • Why are you matching `[` if there is no `[` in your string? – Paolo Aug 06 '18 at 18:34
  • `r'\"start_time\":\"(.*?)\"'` ? – Rakesh Aug 06 '18 at 18:35
  • Are you sure you shouldn't instead parse properly your JSON format and get the start time like `var start = parsedJSON.start_time;`? To me, as soon I see people having JSON-alike strings like `foo text bar "prop":"val"` - is clear sign something went really wrong ;) – Roko C. Buljan Aug 06 '18 at 19:14

1 Answers1

0

This pattern r'\"start_time\":\"(.*?)\"' should help you extract date

Ex: in python

import re
s = 'BLAH text BLAH text "start_time":"2018-08-05T17:41:29.933Z" blah TEXT BLAH text'
print(re.findall(r'\"start_time\":\"(.*?)\"', s))

Output:

['2018-08-05T17:41:29.933Z']
Rakesh
  • 81,458
  • 17
  • 76
  • 113