> Interesting selection of languages to try ;-)  You may have picked the
> ones with a common regex code base.  Russ Cox's article certainly  
> shows
> similar performance/behaviour (See section and graph on Performance at
> http://swtch.com/~rsc/regexp/regexp1.html)  I wonder what Tcl and  
> awk do?

That's looks like an interesting article, thanks.

It doesn't really matter if all those languages share implementation  
code. I just wanted to say that leftmost-longest is not what many  
popular languages do. Java doesn't offer a repl, so I can't be  
bothered to check that ;-)

Tcl does do a longest match, Javascript does the same as Python, Ruby  
and Perl (at least the Spidermonkey implementation; the spec suggests  
that this is correct ( 
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf 
  , 15.10.2.3)).

     nico$ tclsh
     % regexp {ab|abc} "abc" matched
     1
     % puts $matched
     abc

     nico$ ~/src/js/spidermonkey/src/Darwin_DBG.OBJ/js
     js> "abc".match(/ab|abc/)
     ab

Nico

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui