Bastien <b...@altern.org> writes: > Hi Tim, > > Tim Burt <tcb...@rochester.rr.com> writes: > >> : (defun org-datetree-find-year-create (year) >> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ >> \t]*\\(:[[:alnum:]_@]*\\)*:*[ \t]*$") >> : match) >> I've tested with the following headlines: >> - 2013 >> - both with and without trailing spaces >> - 2013 :abc: >> - 2013 :abc123: >> - 2013 :abc123:_underscore:@attaboy:: >> - 2013 :noexport: >> >> Any comments on the regular expression are welcome before I make >> patch. > > Thanks for working on fixing this. > > The more or less standard regexp for tags-till-end-of-line is this: > > :[[:alnum:]_@#%:]*[ \t]*$ > ^ > > With * if you want to match headlines with no tag.
I may have misapplied what you suggested, but the new regexp (see below) does not work on a year headline without tags. : (defun org-datetree-find-year-create (year) : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@#%:]*[ \t]*$\\)") : match) However, the suggestion helped me find the following in org-todo-line-tags-regexp \\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\) Applying this regexp worked on a tag-free headline (both with and without trailing spaces) : (defun org-datetree-find-year-create (year) : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)") : match) > > Please have a look at this page before submitting a patch: > http://orgmode.org/worg/org-contribute.html#sec-5 Will do. > > Thanks! -- Tim Burt www.rketburt.org "It is healthful to every sane man to utter the art within him;" -- GK Chesterton