I am trying to match a regex using this code
(search-backward-regexp "\n[\t\n ]*?\n" nil "NOERROR" 1)
search-backward-regexp documenation says
Set point to the beginning of the match, and return point.
How can I set point to end of match?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
This is a minor modification to @Malabarba's answer. It only goes to
match-end if your search succeeds. Otherwise, the
goto-char will send you off to wherever you had a successful match on a prior regexp search (whether you initiated it, or some other function used it under the hood), which could lead to astonishing jumps.
(when (search-backward-regexp "\n[\t\n ]*\n" nil 'noerror) (goto-char (match-end 0)))
Probably best to wrap this in a function.