Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法我可以写类似的东西
select $1 from tbl where url regexp '/user/(\d+)'
长期获得价值?
您需要通过 转义\,\\而 在()这里没有意义,因为您无法使用 mysql 正则表达式捕获子组。
\
\\
()
select SUBSTRING(url, 6) from tbl where url regexp '^/user/\\d+'
编辑:
select SUBSTRING(url, 6) from tbl where url regexp '^/user/[0-9]+'
(mysql 正则表达式不支持\d)
\d