SQLite - 替换字符串的一部分

SQLite - replace once part of a string

在 SQLite 中是否可以替换字符串的一部分?

例如

UPDATE pages SET path = replace(path, '/page', '/article') WHERE path LIKE '/page/%'"

结果 /page/page1/page2 => /article/article1/article2

但我需要 /page/page1/page2 => /article/page1/page2

就这样吧:

UPDATE pages SET path = replace(path, '/page/', '/article/') WHERE path LIKE '/page/%'"
$l1 = strlen($old_path);
$l2 = $l1+1;

UPDATE pages
SET path = replace(
    substr(path, 1, {$l1}),
    '{$old_path}',
    '{$new_path}'
) || substr(path,{$l2})
WHERE path LIKE '{$old_path}/%'

对我很有帮助