如何使用 REGEXP_REPLACE 从函数中删除参数?

How to use REGEXP_REPLACE to remove parameters from function?

Image Here

我有一个存储 C# 代码的列,如何删除 "FunctionA" 的最后 3 个参数?请注意,该列包含多个函数,但我只需要使用 PL/SQL 替换 "FunctionA",我知道 REGEXP_REPLACE 可能会成功,但我似乎无法找到一种方法来 match/replace它。

之前:

Test=FunctionA(varID, 1234,"", A.B,"","","last");

Test=FunctionA(varID, 9876,"", C.D);

Test=FunctionB(varID, 5555,"", E.F,"","","last");

之后:

Test=FunctionA(varID, 1234,"", A.B);

Test=FunctionA(varID, 9876,"", C.D);<- 应该不会影响这个

Test=FunctionB(varID, 5555,"", E.F,"","","last");<- 应该不会影响这个

尝试找到这个模式:

(,[^,]*,[^,]*,[^,]*\);)$

然后仅替换为 );。这是一个示例查询:

SELECT
    REGEXP_REPLACE ('Test=FunctionA(varID, 1234,"", A.B,"","","last");',
        '(,[^,]*,[^,]*,[^,]*\);)$', ');') AS output
FROM dual
WHERE col LIKE 'Test=FunctionA(%'

Test=FunctionA(varID, 1234,"", A.B);

Demo

编辑:我添加了一个 WHERE 子句来检查函数名称。