Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ...
Sometimes this works, sometimes it doesn't. I can't force it to fail or succeed reliably. Sometimes I can fix it by restarting the engine, sometimes not. Does anyone have any ideas why this might be happening?
My guess is that @JMichaelTX is right - clipboards can often have linefeed or return line endings (and rarely return-linefeed endings), so replacing your use of \n (linefeed) with \R (which matches any of the line endings) should resolve your issue.
I generally prefer your use of \A over ^, since \A always means the start of the entire string whereas ^ can alternatively mean the start of a line within the string - but it doesn't by default so it's largely academic. Also, your regex:
\A.*\R.*\R.*\R.*
will avoid capturing the trailing line ending, so is slightly different to @JMichaelTX which captures the fourth line ending. Which behaviour you want is up to you.
In all this nobody mentioned capturing groups explicitly.
The OP’s screen display showed there weren’t any - both because of the lack of a ( and ) pair and because the action didn’t have the fields which enable you to say which variables get the result of each of the capturing groups.
I am sorry to disappoint everyone but the error has not returned since plaguing me for a day. I'm still using my original regex and there doesn't seem to be any issue... I'll try your ideas if it comes up again. Thanks all
There is a “0” capture group that is implicit that captures the entire match, which is what the OP is using to capture the search of the entire regex.