Evaluating a regular expression range

Posted by Dan Atkinson on Stack Overflow See other posts from Stack Overflow or by Dan Atkinson
Published on 2010-05-21T15:51:34Z Indexed on 2010/05/21 16:00 UTC
Read the original article Hit count: 379

Filed under:
|

Hi there!

Is there a nice way to evaluate a regular expression range, say, for a url such as

http://example.com/[a-z]/[0-9].htm

This would be converted into:

http://example.com/a/0.htm
http://example.com/a/1.htm
http://example.com/a/2.htm
...
http://example.com/a/9.htm
...
http://example.com/z/0.htm
http://example.com/z/1.htm
http://example.com/z/2.htm
...
http://example.com/z/9.htm

I've been scratching my head about this, and there's no pretty way of doing it without going through the alphabet and looping through numbers.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#