I'm trying to search for the last line in a string (lines separated by \n
) using string match but I cannot make it work as intended. The code below evaluates to 0 while I would have expected 4. I guess my regex is wrong (it was supposed to be a newline (\n
) followed by anything but a newline (.*
) until the end of the string ($
).
(string-match "\n.*$" "\n \n \n ")