Hi Nicolas, On Tue, 5 Mar 2019 at 00:23, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: [...] > So, the new challenger is: > > > "\\[\\[\\(\\(?:.\\|\n\\)*?[^\\]\\(\\\\\\\\\\)*\\)\\]\\(?:\\[\\(\\(?:.\\|\n\\)+?\\)\\]\\)?\\]" > > Beautiful. > > The commented rx equivalent would be: > > (seq "[" > ;; URI part: match group 1. > "[" > (group > (*? anything) > ;; Allow an even number of backslashes before the closing bracket. > (not (any "\\")) > (zero-or-more (group "\\\\"))) > "]" > ;; Description (optional): match group 2. > (opt "[" (group (+? anything)) "]") > "]") > > > \( # begin group 3 > > ? # don't understand > > :\[ # literal :[ > > [...] > > > but there's at least a ? that I don't understand, and I'm afraid I'm > > not seeing how it's useful. > > \(?: ... \) is a shy group.
Thanks for explaining that. It's not mentioned in the manual though (https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html); are you sure that it's supported in Emacs regexps? > > If you think it works, I'm happy to defer to your judgement on that! > > Although I suggested the idea, I don't know Org nearly well enough to > > be sure that I haven't missed problems; > > We are solving the problem with a regexp. What bad things could happen? ;) Well hopefully the fallout is limited to destroying all of the text in one Org buffer. :-) More seriously, though, I don't understand when and how the regexp is used. Presumably you loop through the buffer looking for matches, but what do you do after each match? Regards, Neil