[swift-evolution] [Swift4] Priorities and Sugar
Charlie Monroe
charlie at charliemonroe.net
Sat Jul 30 04:37:05 CDT 2016
> Foundation already has NSRegularExpression. Do you mean that the
> stdlib could potentially duplicate Foundation functionality?
NSRegularExpression is not really easy to use for most common usecases (first match in string, etc.) + it lacks a lot of features e.g. Python has (named groups, etc.). I've personally never used NSRegularExpression and rather wrote an ObjC wrapper around re2 (https://github.com/google/re2/).
I'd really like Swift's regex to be much more powerful and be able to match against it in a switch:
switch someString {
case /\d+:
...
case /w+:
...
...
Also, you can have compile-time check whether the expression is valid if regex is part of the language. But that's kind of getting too specific and away from the original discussion.
> If so,
> what are the implications for Foundation (and
> swift-corelibs-foundation)? Does this also mean that other "stringy"
> functionality could arrive in the stdlib, for example a Swifty JSON
> serializer/deserializer?
>
> Best wishes,
>
> --
> Ian Partridge
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list