Hi @tea4or2wo I’m not very proficient with regexps to write them on the fly and currently do not have enough time to sit and figure it out.
Below is a pseudocode for how one may achieve what you want.
:PROPERTIES:, you’d need soomething like this:
1. Match the word :PROPERTIES: literally + end of line
2. Match any number of chars up to the end of line
3. Match expression 2 zero or more times in a non-greedy way
4. Match the word :END: literally + end of line
Also check the Org-mode source code. Look up variables starting with
org and containing
regexp. There are plenty of them and some of the are sure dealing with properties. Maybe you’ll find some hints.
To match titles, first of all listen to that comment by TRSx80 and simplify your regexp.
If you are using only Org-mode files with Deft then you obviously do not need
^Title:[ ]*\\|#+$ at all, since it matches Markdown-style titles
Title: anything. If you don’t use file-local variables then you don’t need this part as well
-\\*-[[:alpha:]]+-\\*-\\|, which matches
-*- anything -*-
Skipping the first 10 lines for summary should be even easier:
1. Match anything up to the end of line
2. Match expression 1 exactly 10 times
You may also find useful the
rx macro. It comes with a built-in Emacs
rx package that allows for writing regular expressions in the form of Lisp s-expressions:
(rx (and (or "TITLE" "title")
produces this regular expression:
Since it is Elisp, you can use the macro directly in the code, e.g.
(setq deft-strip-title-regexp (rx ...))
Also, don’t forget about the excellent
regexp-builder command. It allows to build regular expressions on the fly using either standard Elisp regexps or the
rx s-expressions. It will highlight matches in the buffer as you type the regexp.
Hope this helps.