From: John Joyce Date: 2007-07-11T18:03:48+09:00 Subject: Re: Beautiful Code : Pity he didn't ask here... On Jul 10, 2007, at 9:08 PM, Marcel Molina Jr. wrote: > On Wed, Jul 11, 2007 at 10:53:42AM +0900, ara.t.howard wrote: >> %r|GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+)|x > > Looking at all those \d is kind of hard to parse also. I think the > following > way of expression that pattern is considerably clearer: > > %r|GET /ongoing/When/\d{3}x/(\d{4}/\d{2}/\d{2}/[^ .]+)|x > > Readability improves even more when Oniguruma allows for named > captures. > > marcel > -- > Marcel Molina Jr. > It is hard to parse. That's why all RegExes should include a comment describing wtf it is supposed to match! Ideally, with an example string. Oh, wait, that's halfway to a test unit!