开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜