regex for routing in rails 2.3.11
I am looking for a regex which can let开发者_如何学运维 me have a dot in the id in rails routes except the case when the format requested is xml or json, i.e. http://www.abc.com/users/e.f.json should mean id=e.f and format=json http://www.abc.com/users/e.f should mean id=e.f
Can someone help me? Thanks!
Use this Regex:
/users\/(\w*\.\w*)(\.json|\.xml)?/
See tested code here.
精彩评论