[swift-evolution] Empower String type with regular expression

Chris Lattner clattner at apple.com
Mon Feb 1 15:55:27 CST 2016


> On Feb 1, 2016, at 6:47 AM, Patrick Gili <gili.patrick.r at gili-labs.com> wrote:
> 
> Hi Chris,
> 
> Thank you for the feedback; it is much appreciated.
> 
> I like the idea of folding this into the language's pattern grammar. It makes it more Swifty. I didn't see that direction, and I will investigate it further.
> 
> I have been looking a lot at Perl 6. In fact, a lot of languages these days use PCRE or PCRE2, which was based on Perl's implementation of regular expressions. Does this mean there is attitude to move away from the regular expression implementation used by the foundation today?

PCRE is based on Perl 5 regular expressions.  You are correct that they are well known and widely used, but they also have a lot of problems, and Perl 6 made them a lot better.

This is the first hit I had for “Perl 6 regex”:
http://doc.perl6.org/language/regexes

Things I like about them:
1) They mostly use the standard regex operator grammar x?, x*, x+, etc.
2) They allow free form style.
3) They allow comments within them.
4) Unicode aware and correct.
5) They are checked and validated by the compiler (not just a string fed into a runtime call).

etc.




-Chris



More information about the swift-evolution mailing list