Hallo, zusammen,

mir ist gerade beim Überblättern eines "Beta-Buches" bei PragProg ein
neues Feature bei ruby1.9 aufgefallen: named groups.

http://media.pragprog.com/titles/ruby3/code/samples/tutstdtypes_50.rb :

    #---
    # Excerpted from "Programming Ruby",
    # published by The Pragmatic Bookshelf.
    # Copyrights apply to this code. It may not be used to create training 
material, 
    # courses, books, articles, and the like. Contact us if you are in doubt.
    # We make no guarantees that this code is fit for any purpose. 
    # Visit http://www.pragmaticprogrammer.com/titles/ruby3 for more book 
information.
    #---
      /(?<hour>\d\d):(?<min>\d\d)(..)/ =~ "12:50am"
      "Hour is #{hour}, minute #{min}"


In python habe ich das schon 1998 oder so benutzen können.
Ist sicherlich ein Teil der "GNU regexp library" oder so.
Und die verschiedenen Programmier-Sprachen-Implementierungen ziehen das
halt wohl unterschiedlich schnell nach.

Nur schade, dass ruby1.9 nicht problemlos mit rails-1.2.* zusammengeht ;-(

Ciao
J.
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an