tags:

views:

58

answers:

1

The Ruby in Tim Bray's Wide Finder benchmark (http://wikis.sun.com/display/WideFinder/The+Benchmark) has this line:

%r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) }

I've been using regexes for a long time, but I'm not sure what the point of the "." is. It seems to match on anything that's not a space, but [^ ] would do that anyway.

When I first looked at it, it looked to me like it would match on nothing except possibly a line break.

Can anybody explain the behavior of this expression?

+7  A: 

[^ .] means match any single character apart from a space or a literal period. The period does not have a special meaning when inside square brackets.

Mark Byers
Perfect. Thanks much.
Empty Pockets