0

I am trying to modify org-wikinodes.el to match any org-mode headline (not just camelCase text. So I have replaced the default regular expression with:

*\\s-\\(.+\\)

This works. But in order to link back to say My headline I have to write my link as * My headline.

The question is, how can I get org-mode to only match group 1 of the regex, so that I can link back to My headline without including the *?

Thanks!

  • I had a look at wikinodes.el. CamelCase is inherent to that mode. You cannot reach your objective through just changing the regular expression org-wikinodes-camel-regexp. See, e.g., org-wikinodes-activate-links. – Tobias Oct 24 '16 at 12:47
  • Are you asking how to get the first match in code, i.e. the (match-beginning 1) function, or how to change the file so that it uses the first sub-match rather than the whole match (i.e. change 0 to 1), or how to write a better regular expression to match an org-mode headline, or does elisp have lookbehind in regular expressions (no) or something else? I agree with @Tobias if my guesses of what you want to do are correct. – icarus Oct 24 '16 at 14:50
  • I would like to write a regex that matches the first group only: thus returning the heading minus the "* ". Thanks. – Adam Oct 25 '16 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.