Q: how do I extract an org-mode link label?

Given an org-mode internal link with the following format:


How do I extract link-label?

I need to process the link as a string, not interactively in an org-mode buffer. I could write a regexp to do this, but am wondering if there's a function already built in.

2 Answers 2


You want something like this. The regexp you want is already defined in the variable org-bracket-link-regexp.

(let ((s "[[link-target][link-label]]"))
  (string-match org-bracket-link-regexp s)
   (match-string 1 s)
   (match-string 3 s)))

This should return a list of ("link-target" "link-label")


org-copy-visible, bound to C-c C-x v, should do the job for you.

  • Unfortunately, that won't work for my use case, which is to process a string. I've updated the question.
    – Dan
    Feb 20, 2017 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.