Commit 498535fb authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

(looking-back): New function to check for regular expression before point.

parent a44c6ff3
......@@ -1820,6 +1820,19 @@ STRING should be given if the last search was by `string-match' on STRING."
(buffer-substring-no-properties (match-beginning num)
(match-end num)))))
(defun looking-back (regexp)
"Return t if text before point matches regular expression REGEXP.
This function modifies the match data that `match-beginning',
`match-end' and `match-data' access; save and restore the match
data if you want to preserve them."
(save-excursion
(let ((beg (point)))
(if (re-search-backward regexp nil t)
(if (= (match-end 0) beg)
t
nil)
nil))))
(defconst split-string-default-separators "[ \f\t\n\r\v]+"
"The default value of separators for `split-string'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment