RegEx Match The Last Line and First Line Of A Variable?

(First and Last are two different questions, not trying to get both at the same time )

Simple Question but I haven't been able to figure out how to use the end of the text or start of the text as an anchor to get the last line.

Easy.

First Line:
^(.+)\R

Last Line:
\R(.+)$

The line is returned in the first (only) Capture Group.

1 Like

Thanks, think I was thrown off by trying to use Regex101 to solve this. Do you know why this doesn't work in Regex101?

It DOES work in RegEx101.com. I used it to develop/confirm what I posted.

The reason it does not work for you is that you have set RegEx Option for "Multiline":
image

Ahhhhh, i see, thank you