[Solved] Regular expression to match something followed by two different string [closed]


If the name doesn’t contain whitespaces then you have to look for the first whitespace instead of the word “inflicted”. I would try something like

^(.*?)\s.*?$

You can simply test regular expressions online for example with https://regex101.com/

EDIT

Depending on your comment also whitespaces are possible in the name. So we cannot search for the first occurrence of a whitespace. Instead try to use

^(.*?)(\shas)?\sinflicted$

Note: a name ending with ” has” might get cut off. With this lines only as input you are not able to detect if it’s part of the name or not.

solved Regular expression to match something followed by two different string [closed]