On Mar 13, 2017, at 12:57 PM, Martin S. Weber <ephae...@gmx.net> wrote: > > On 03/13/17 19:00, Warren Young wrote: >> On Mar 13, 2017, at 10:32 AM, Natacha Porté <nata...@instinctive.eu> wrote: >>> Or do you expect it to count parentheses and prevent you from ever >>> linking to a URL with unbalanced parentheses? >> >> Yes. Other Markdown processors do that. > > It doesn't necessarily have to count parens, in the specific case mentioned > by Warren opting for the longest instead of the shortest syntactically > correct match would do as well. In other words, use > regexen naively, duh :)
Regex matching of URLs is difficult: https://mathiasbynens.be/demo/url-regex It doesn’t seem that src/markdown.c uses regexes. At least, I don’t see any “regex” or “regcomp” text in that file. A simpler method that may also work is: 1. Count parens and don’t close the URL until the paren count goes to 0. (Open paren = +1, closed = -1.) 2. …unless you hit a whitespace, EOL, or other thing after a closed paren that clearly means the URL is finished. That would let you have unbalanced parens, too. _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users