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)})\/?$/
精彩评论