On Jul 9, 2009, at 10:22 AM, mdipierro wrote: > > >> There's a lot to be said for using re.X when writing expressions like >> this. Here's a quick hack as the current one. > > what does it do?
re.X? It's the same as the x switch in Perl: /regex/x It causes white space and # comments to be ignored by the regex parser, allowing the author to format and document the regex in place. (Consequently whitespace and # have to be escaped if they're used in the regex, but that's not often a problem.) > >> One thing that jumps out at me (assuming I've done it right) is that >> the handling of 'sub' and 'ext' doesn't match the documenting >> comment; >> they're in reverse order. > > you are right. the comment is wrong > >> A small point: you don't need to escape dot in character classes, nor >> minus if you put it first, nor (I think) equals ever. So [\w\-][\= >> \./] >> could be [-\w][=./]. I think. (I find that pattern a little puzzling, >> btw.) > > It is designed to avoid .. (which may cause directory traversals) and > double // (which would result in empty args) > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---