builtin regular expressions?

MonkeeSage MonkeeSage at gmail.com
Sat Sep 30 20:15:08 EDT 2006


Roy Smith wrote:
> More to the point:
>
> You can stick it in a bottle, you can hold it in your hand, AMEN!

That's simply an implementation detail of perl regexps; it doesn't
really address the issue. For example, in ruby a regexp is an object.
Matches are also objects when one uses the String#match and
Regexp#match methods rather than the =~ operator:

s = 'file=blah.txt'
r = /file=(.*)/
puts r
# => (?-mix:file=(.*))

m = s.match(r)
puts m.inspect
# => #<MatchData:0xb7c24f90>

m = r.match(s)
puts m.inspect
# => #<MatchData:0xb7c24e64>

Regards,
Jordan




More information about the Python-list mailing list