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
I would do it like this (edit: added anchors to cover most cases):
(\S+\s+|^)(\S+\s+|)here is(\s+\S+|)(\s+\S+|$)
Like this you will always have 4 groups (might have to be trimmed) with the following behavior:
Corrected demo link