[swift-evolution] Empower String type with regular expression
Jerome Paschoud
jerome_paschoud at mac.com
Tue Dec 8 14:14:20 CST 2015
I would like to see the String type to support regular expression per default. I think that a language that advertise itself as being a good scripting language should provide in its default implementation an easy way (=~ for example in Perl) to use regular expressions. I know that one can use the NSRegularExpression, but who really what to first create an NSRegularExpression object(whit all the nice escaping operation that come with every \), then get a NSTextCheckingResult, then get a range (and what I mean is a NSRange and not a NSRange<String.Index>) and finally perform slicing of your original string.
I realize that it could be considered as purely syntactic sugar, but what a nice one.
Jérôme
More information about the swift-evolution
mailing list