[swift-evolution] Empower String type with regular expression

John Randolph jcr at mac.com
Wed Feb 3 05:43:00 CST 2016


> On Feb 2, 2016, at 9:29 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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). 


I really like this idea.   It would be very nice to be able to describe a regex like “(name:String),  (dateOfBirth: NSDate), (notes: String), (EOL)”   and have the details of what characters constitute each of these types be specified on a per-type basis.  NSScanner can do something a bit like this, but it requires quite a bit of care and feeding.

-jcr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160203/96f9daa9/attachment.html>


More information about the swift-evolution mailing list