In the example below, a dialogue between two people I want to match only the interrogators text. (The text on the left)
Hello, how are you? I am fine.
What is your name? My name is Simon.
What does Simon say? Put your hands on your head.
When I perform a regular expression individually on each line I want to extract
Hello, how are you?
What is your name?
What does Simon say?
However, I also want to allow for room for error in the questioning text allowing for up to 5 white spaces between words. The number of white space between the questioner and the answerer is always over 5 characters.
I have tried this
([^ ]| {0,5})*
but that captures the whole line
And this
[^( {0,5})]+
but I guess you can’t use parenthesis in between brackets to evaluate the inner text first and specify that as a single character.
Any ideas are welcome, thanks 🙂
1 Answer