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 Something, ?, Count('Something2') AS Total FROM table WHERE Id=? AND Time>NOW() FOR UPDATE
现在我需要搜索?betweenSELECT和FROM。我怎样才能做到这一点?就像是SELECT \? FROM
?
SELECT
FROM
SELECT \? FROM
使用前瞻仅匹配“?”
(\?)(?=.*FROM.*)
确保使用不区分大小写,这样您就不会错过from以小写形式编写的查询。
from
大多数正则表达式风格不支持不固定大小的lookbehind - 这就是为什么您不能在正则表达式中使用 SELECT 的原因。