I'd like to use a regular expression to filter culture names (like en-US or pt-BR). Anyone has any idea?
Thanks! Unfortunately my ASP.NET MVC2 route doesn't work anyway :/
Rodrigo Waltenberg
2010-09-09 12:35:48
@Rodrigo Waltenberg: Note that `^` and `$` mark the begin and end of the string respectively. Maybe you need that regular expression without these anchors.
Gumbo
2010-09-09 13:12:28
A:
@Gumbo is right. A test:
In [1]: import re
In [2]: reg = re.compile("^[a-z]{2}-[A-Z]{2}$")
In [3]: url = 'en-US'
In [4]: m = reg.match(url)
the result shows that it Matched.
Tauquir
2010-09-09 12:24:09