ChevalierLxc
V2EX  ›  问与答

问一个关于 sed 正则替换的问题

  •  
  •   ChevalierLxc · Aug 11, 2023 · 1499 views
  •   You need to sign in to view this topic
    This topic created in 1213 days ago, the information mentioned may be changed or developed.

    是这样的,我想替换 sql 里的 params 变成问号,在编辑器里的是可以成功匹配,但是 sed 失效 举例

    select * from tables where id = '1233445561';
    

    结果是

    select * from tables where id = ?;
    

    使用正则

    sed 's/(=\s*\x27)[^\x27]+\x27/=?/g'
    

    该命令无法生效。 但是在编辑器里 (=\s*\x27)[^\x27]+\x27这个正则是可以找到'1233445561'的, 有没有大佬试试?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 18:14 · PVG 02:14 · LAX 10:14 · JFK 13:14
    ♥ Do have faith in what you're doing.