Actually it’s no real json response - sorry for that mistake (no brackets like { or [).
I thought so to check for new lines and I also tried \r\n and \n without a result.
If it’s true that each single line will be checked, why doesn’t REGEX not return the first and second line?
locked: (yes|no)\n
returns the entire String
same with
\nlocked: (yes|no).*\n
\nlocked: (.).\n
returns the entire string as well.
REGEX uses a greedy search. So the heater one works because there is nothing after the “off” on that line. But for locked, it is including the heater line as well because .* matches any character, including new lines and spaces and such and you didn’t give it anything to stop the match. So, assuming that the text is always of this format
The (.*) is the part that we want returned and will match everything up to the [\s]+ which matches one or more whitespace characters which includes newlines.
The final .* matches the rest of the string. I’ve found that you will have the best results if your REGEX matches the whole String. I’ve not had good luck using \g to do that.
If that fails, you have help it by adding the heater line to the expression: