开发者

Regex for localized paths

What can I do to make this regex match '/en/' and '/en'? (edit: as well as '/en/foo') It matches '/en/foo'.

:locales = %w[en ja]
:pa开发者_运维技巧ttern = /^\/?(#{Regexp.union(:locales)})(\/.+)$/


:pattern = /^\/?(#{Regexp.union(:locales)})\/?$/
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜