<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><DIV>On Jun 24, 2005, at 12:46 AM, Allan Odgaard wrote:</DIV><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Problem is that if there's no legal end pattern, the begin pattern shouldn't have been taken.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I was thinking one could perhaps do something like:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">{ <SPAN class="Apple-converted-space">  </SPAN>name = "markup.bold.markdown";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>begin = "\\*(?=.*?<pattern-to-verify-legal-end-marker>)";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>end = "\\*";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>patterns = (</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">        </SPAN>{ include = "#escape";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">},</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Though I don't think that “pattern-to-verify-legal-end-marker” is any simpler than doing the actual match, since the match would just be to remove “(?=” and “)”.</DIV></BLOCKQUOTE></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV>Here is one suggestion for "markup.italic.markdown":<DIV><BR class="khtml-block-placeholder"></DIV><DIV>([*_])(?=\\S)((.*[^\\\\])?([^\\\\](\\\\\\\\)*)?[^\\s\\\\]?)(\\1)<DIV><BR class="khtml-block-placeholder"></DIV><DIV>There might be a simpler way to ensure that the closing character is not precluded by a space or an odd number of backslashes, but too late for me to figure it out now. Maybe in the morning. Currently it fails for _\\\\_ but passes most other cases I tried. Tomorrow I'll do a checkout of the bundles and check with the recent test-markdown, but maybe someone else can check earlier.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ok, a better one, dealing with the case of only \\\\, is:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>([*_])(?=\\S)(((.*[^\\\\])?([^\\\\](\\\\\\\\)*)?[^\\s\\\\]?)|((\\\\\\\\)*))(\\1)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>but I have to admit, at that point I start wondering whether we should disregard things that are "highly unlikely to be of any practical use", as for instance emphasizing a sequence of backslashes. I feel there is a balance between the complexity of the RE and the breadth of cases it deals with. Of course, if there is no processing time penalty, then more is better. :-)</DIV><DIV> <BR><DIV> <DIV>Haris</DIV><DIV><BR class="khtml-block-placeholder"></DIV> </DIV><BR></DIV></DIV></BODY></HTML>