<div dir="ltr">Also <a href="https://github.com/rust-lang-nursery/regex">https://github.com/rust-lang-nursery/regex</a>, which is the process of possibly being standardized either in the Rust stdlib or as a fully supported crate (library). That crate is based on <a href="https://github.com/google/re2">https://github.com/google/re2</a> that is written in C++. Both could be used for implementation ideas.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 4, 2016 at 9:52 AM, Vincent Esche via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">There is actually a Rust crate doing exactly that: <a href="https://github.com/jneem/regex-dfa" target="_blank">https://github.com/jneem/regex-dfa</a><div>Rust however has powerful compile-time macros, enabling this, which Swift doesn’t (yet?).</div><div><br><div><blockquote type="cite"><div>On 04 Jan 2016, at 02:53, Austin Zheng via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>+1 on first-class regex support/pattern matching on regex patterns.</div><div><br></div>There was a thread a while ago discussing compile-time code generation, and if I recall correctly one of the stated use cases was &#39;compiling&#39;/&#39;building&#39; (don&#39;t know the real terminology) regex literals at compile-time. Is there a bigger overall vision for this sort of feature, or would it be better to just focus on better regex support?<div><br></div><div>Best,</div><div>Austin</div></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Sun, Jan 3, 2016 at 1:35 PM, Chris Lattner via swift-evolution<span> </span><span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><span><div><blockquote type="cite"><div>On Jan 1, 2016, at 4:44 PM, John Joyce via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><div><div style="word-wrap:break-word"><blockquote type="cite"><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)">It is also probably worth burning first-class language support for regexes.  This would allow specifying variable captures inline in the pattern, would allow flexible syntax for defining regexes, support powerful extensions to the base regex model (e.g. Perl 6 style), and would provide better compile-time checking and error recovery for mistakes.

-Chris</pre></blockquote><div>I know this is an old thread already, but this sure would be one of the major breakout pieces of functionality.</div><div>If Swift had native regular expressions, without all the noise you see in the Objective-C API that exposes ICU regular expressions, the adoption rate would be huge.</div><div>If they were *truly* native, as in somebody sat down and built an NFA (or one of the fancier approaches that mixes with DFA) state machine, Swift&#39;s best-in-class Unicode support would and could result in amazing things.</div><div>It&#39;d boost the scripting use of Swift tremendously and seal the deal as a server side language.</div></div></div></blockquote><br></div></span><div>Totally agreed.  switch on a string with a bunch of regexes being matched should turn into a parallel state machine, just like a lexer :-)</div><div><br></div><div>-Chris</div><br><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=7XtDdMHRjqIUi4tzSjSp2pWQIyxYdP6woIWn4vwV5ge3DorJi-2BEWPFrlpjCsTHngqYQQAyB4p8WoaSvnv0yIzuva8NDiIpeFwSdgjPu-2Fx0fvOSIZEmKdSUWxT71YcU0tA1FWxnQLGoLJGi6O2-2Bs-2B0bFvqMhuOZgoXOT1XczgTQlqa0MzFmLpMHedVktcWA0Qm6FpJCRf0OeWv4ehYZ5YBWxY7K9o569aICe1yH84O5M-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br></blockquote></div><br></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=VbTStA9jyILqr7IzQe9KAt-2FaH8ZqpHcRullRxZjIJSabq6Vr4DakVqvoieTGrxJvMXNHPzHZaM6m660Id0lVDN6kPHXKjVBhtUf1HubVktLnhS0Oab982gqykKh4G083vbKill19VMv7gz3etzYBPql1BaTil7Np4J4P9w-2FQPD-2BmdYLn8-2BW3yIWm1TwLc3ZcacSwsY3IWiUSDT1Ql1jldSSbTBG7PXjDc41uNUBiJV3scVEsq-2FymGbvRVdDsUX2d" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=PLxfwCJEjPeWvUDZqEq2h1e5BRs1s4m99sV2gcalz-2FRPvu96WEgmVR1i9FoRjhKSUD3qUSb5CAVnhpeLpT3-2F3U8vz5vjYe2iFPhXrxx9VqHgizPK-2FeToHqPefZTszZ198v2R3M3k5KskGiWI0Y2aGUHztME8Cf607gEnt-2FoXNrh95rj0vRDkf-2FTDW6wIhtTn9bTz7CMtrmSaElvC8LY5QlKHVNaCzPUaoKlHZIqPR74-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Trent Nadeau</div>
</div>