开发者

Regex for localized paths

开发者 https://www.devze.com 2023-03-21 05:14 出处:网络
What can I do to make this regex match \'/en/\' and \'/en\'? (edit: as well as \'/en/foo\') It matches \'/en/foo\'.

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

精彩评论

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