Alan Schmitt <alan.schm...@polytechnique.org> writes: > Would the following work as a regexp builder that allows arbitrary space > and cookies between each word (making sure there is at least one)? > > #+begin_src emacs-lisp > (defun org-heading-regexp-build (s) > (let* ((sp (reverse (org-split-string s)))
You can ignore SP for the time being. > (wspace "[ \t]") > (wspaceopt (concat wspace "*")) > (cookie (concat "\\(?:" > wspaceopt > "\\(?:\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]\\)" "\\[[0-9]*\\(%\\|/[0-9]*\\)\\]" statistics cookies can be empty. > wspaceopt > "\\)")) > (sep (concat "\\(?:" wspace "+\\|" cookie "+\\)")) > res) > (dolist (w sp) (setq res (concat w sep res))) > (concat sep res)) (concat sep (mapconcat #'identity (org-split-string s) sep) sep) > This of course needs to be extended with the other headline features > (todo keyword, tags, …) I don't think so. Other features can be ignored (see, e.g., `org-get-heading'). Regards,