I\'m using Python to search some words (also multi-token) in a description (string).
To do that I\'m using a regex like this
result = re.search(w
How about string operations?
line = 'Parking here is horrible, this shop sucks.' before, term, after = line.partition('here is') before = before.rsplit(maxsplit=2)[-2:] after = after.split(maxsplit=2)[:2]
Result:
>>> before ['Parking'] >>> after ['horrible,', 'this']