[Tim] > So some gratuitous differences, and maybe a killer: Guido hasn't had much > kind to say about "longest" (aka POSIX) matching semantics. > > An example from the page: > > (week|wee)(night|knights) > matches all ten characters of `weeknights' > > which means it matched 'wee' and 'knights'; Python/Perl match 'week' and > 'night'. > > It's the *natural* semantics if Andrew's suspicion that it's compiling a DFA > is correct; indeed, it's a pain to get that behavior any other way! Possibly contradicting what I once said about DFAs (I have no idea what I said any more :-): I think we shouldn't be hung up about the subtleties of DFA vs. NFA; for most people, the Perl-compatibility simply means that they can use the same metacharacters. My guess is that people don'y so much translate long Perl regexp's to Python but simply transport their (always incomplete -- Larry Wall *wants* it that way :-) knowledge of Perl regexps to Python. My meta-guess is that this is also Henry Spencer's and John Ousterhout's guess. As for Larry Wall, I guess he really doesn't care :-) --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4