Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single quotes as special characters in elisp regex

Tags:

emacs

elisp

(defun string-is-capitalized (str)
  (let ((case-fold-search nil))
    (string-match-p "\\`[A-Z]*\\'" str)))

in the above regex, what does the single quotes backward & forward ` & ' do? i don't see it as a special code in gnu page, http://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Special.html


1 Answers

The backslash-backtick \` matches the empty string only at the front of the string or buffer being matched, while backslash-single-quote \' matches the empty string only at the end of the string or buffer being matched. You can find them documented in the Regexp Backlash documentation.

like image 126
Steve Vinoski Avatar answered Sep 07 '25 16:09

Steve Vinoski