Regex: Python First Occurrence After Return or Newline -
i'm trying match set of data, , while can create regex correctly, python returns no match. i'd know if i'm formatting regexes in python correctly.
i'm trying match date after \r or \n. can of following:
date/time sep 12 11:13:42 date/time sep 12 11:13:42 date/time sep 12 11:13:42 date/time sep 12 11:13:42
and using (?<=date/time\s)(\r*[\w :]+)
works far validator concerned.
i input date = re.findall("(?<=date/time\s)(\r*[\w :]+)", content)
never matches returned.
the regex formatted correctly. question whether regex formatted incorrectly far python concerned (illegal characters, etc.)?
but... works:
content = """\ date/time sep 12 11:13:42 date/time sep 12 11:13:42 date/time sep 12 11:13:42 date/time sep 12 11:13:42""" import re re.findall("(?<=date/time\s)(\r*[\w :]+)", content) #>>> ['sep 12 11:13:42', ' sep 12 11:13:42', 'sep 12 11:13:42']
you should consider using \n
instead of \r
, though, last date. maybe use \s
match spacing.
Comments
Post a Comment