That's incorrect:
set null <NULL>
with rws as (
select q'|param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1|' txt from dual
)
select replace( regexp_substr(txt,q'|,\s\s(.)*'.*',\s\s|') ,'=','%') x1 from rws;
X1
<NULL> Chirs - you changed the inputs.
https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9532244000346199677#9532301800346109783 select q'|param1=1, param2='age=24, sex=M, sal=500', param3=, param4='24'|' as orig_str
------------------>##
We should have two space between "," and "Param2" (the same for others occurrences) - but that is missing with your sql.
Rerunning it with right inputs - will get the outputs like this.
demo@ORA12C> set null <NULL>
demo@ORA12C> with rws as (
2 select q'|param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1|' txt from dual
3 )
4 select replace( regexp_substr(txt,q'|,\s\s(.)*'.*',\s\s|') ,'=','%') x1 from rws;
X1
------------------------------
<NULL>
1 row selected.
demo@ORA12C> with rws as (
2 select q'|param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1|' txt from dual
3 )
4 select txt , regexp_substr( txt ,q'|,\s\s(.)*'(.)*',\s\s|') from rws ;
TXT REGEXP_SUBSTR(TXT,Q'|,\S\S(.)*'(.)*',\S\S|')
------------------------------------------------------------- -------------------------------------------------------------
param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1 , param2='age=24, sex=M, sal=500',
1 row selected.
demo@ORA12C> with rws as (
2 select q'|param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1|' txt from dual
3 )
4 select txt , replace( regexp_substr( txt ,q'|,\s\s(.)*'(.)*',\s\s|'),'=','%') from rws
5 /
TXT REPLACE(REGEXP_SUBSTR(TXT,Q'|,\S\S(.)*'(.)*',\S\S|'),'=','%')
------------------------------------------------------------- -------------------------------------------------------------
param1='1, 2, 3', param2='age=24, sex=M, sal=500', param3=1 , param2%'age%24, sex%M, sal%500',
1 row selected.
demo@ORA12C>