3 ms·
> My thought process has always been that regex was language agnostic. +1 I was surprised to find that regex in python was not much different from the languag
by Lordarminius 7y ago
> My thought process has always been that regex was language agnostic.
+1
I was surprised to find that regex in python was not much different from the language I use ruby. Would anyone with sufficient knowledge care to eli15 why this is and how it is implemented ?
- cutler 7y agoRuby's regex engine is Onigmo which is very similar to Perl 5.10. Perl was one of Ruby's main influences, along with Smalltalk and Lisp, whereas Python's BDFL was never a fan of Perl. However, Perl's implementation of regular expressions (PCRE) has been widely adopted hence the similarity you refer to. If you compare with Javascript and PHP you'll find they're all similar.
- redis_mlc 7y agoPerl is a superior language. Besides being the fastest scripting language by far ... Ruby was inspired by it. Python stil can't do forward references, amongst many other puzzling limitations. I'm sure Python 3's split() improvements were copied from Perl.