<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2016, at 9:29 PM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: MyriadSet-Text; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">If you bring the same concept to regex parsing, I think it would make a lot of sense for primitive types to support “default” regex rules (e.g. integers would default to /[0-9]+/ ) and then have modifier characters that support other standard modes for them (e.g. x for hexadecimal).<span class="Apple-converted-space">&nbsp;</span></span></div></blockquote></div><div class=""><br class=""></div><div class="">I really like this idea. &nbsp; It would be very nice to be able to describe a regex like “(name:String), &nbsp;(dateOfBirth: NSDate), (notes: String), (EOL)” &nbsp; and have the details of what characters constitute each of these types be specified on a per-type basis. &nbsp;NSScanner can do something a bit like this, but it requires quite a bit of care and feeding.</div><div class=""><br class=""></div><div class="">-jcr</div></body></html>