[swift-evolution] String update

David Hart david at hartbit.com
Wed Jan 17 16:08:44 CST 2018


While we’re on the topic of regular expressions, can someone confirm if the direction that the document is taking supports naming capture groups inside repeating patterns and automatically typing them to arrays?

let name = /
    (let firstName: String <- \w+) \s
    (let initials: [String] <- \w)* \s
    (let lastName: String <- \w+)
    /
print(type(of: name)) // => Regex<(firstName: String, initials: [Character], lastName: String)>

On 16 Jan 2018, at 23:20, Michael Ilseman via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:

> Significant leading zeros is a good point. Another would be non-default-radix.
> 
>> On Jan 16, 2018, at 12:22 PM, C. Keith Ray via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> people may want digits as characters in order to see zeros. parsing phone numbers and social security numbers need zeros.
>> 
>> C. Keith Ray
>> https://leanpub.com/wepntk <https://leanpub.com/wepntk> <- buy my book?
>> http://agilesolutionspace.blogspot.com/ <http://agilesolutionspace.blogspot.com/>
>> twitter: @ckeithray
>> http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf <http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf>
>> 
>> On Jan 16, 2018, at 11:24 AM, Eneko Alonso via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> Digits could always be inferred to be numeric (Int) and they should always be “exact” (to match "\d"):
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180117/586fd502/attachment.html>


More information about the swift-evolution mailing list