<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 8, 2013, at 10:25 AM, Don Green wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">


        
        
        
        <style type="text/css">P { margin-bottom: 0.08in; }</style><p style="margin-bottom:0in">Regexp
question: Is there a pattern that can match everything to left of first pattern?<br></p><div style="margin-bottom: 0in; ">
<br class="webkit-block-placeholder"></div><p style="margin-bottom:0in">(regexp-match #rx"x.*"
"12x4x6") ; =&gt;  '("x4x6") ;returns everything
to right of first pattern x</p><p style="margin-bottom:0in"><br>
</p><p style="margin-bottom:0in">(regexp-match #rx"___"
"12x4x6") ; =&gt;  '("12x") ;returns everything
to left of first pattern x</p><div><br></div></div></blockquote><div><br></div><div>The traditional way to do this would be to match a sequence of non-x's followed by an x, like this:</div><div><br></div><div><div>#lang racket</div><div><br></div><div>(regexp-match #rx"[^x]*x" "12x4x6") ; =&gt; '("12x")</div><div><br></div><div>Things get a bit more interesting if you put a more complex pattern in place of a simple "x".</div><div><br></div><div>John Clements</div><div><br></div></div></div></body></html>