scripting – using regular expression in bigquery

I have a table in bigquery with some formulas and would like to replace few things from it.

SELECT FORMULA,element.name,FUNCTIONS.fun_temporal FROM `test-project.FORMULAS.FORMULA_HISTORY`
,unnest(COUNTER_GROUP_INFO) as element
where SOURCE_KPI_NAME in ('A01_ACD_OUT','A01_ANSW_ERL_OUT','ETH_PORT_TRAF_BYTES');

enter image description here

This results above list of formulas which I would like to convert as below: ie a name column equivalent should be replace with fun_temporal and rest other character should also get replaced or removed.

actual -   ((`A01`).(`Answer_time_unit_second`)/60)/(`A01`).(`Answer_number`)
expected - safe_divide((sum(Answer_time_unit_second)/60),sum(Answer_number)) as A01_ACD_OUT

actual - (((`A01`).(`ANSWER_Traffic_UNIT_ERL`)))
expected - sum(ANSWER_Traffic_UNIT_ERL) as A01_ANSW_ERL_OUT

actual - (`a02`).(`INOCTETS`)+(`a02`).(`OUTOCTETS`)
expected - sum(INOCTETS)+sum(OUTOCTETS) as ETH_PORT_TRAF_BYTES

Is it possible to do such conversion in BQ or using shell?

I was trying something but didn’t worked

SELECT REGEXP_REPLACE(REGEXP_REPLACE(FORMULA, r'((`()"))', ''),element.name,FUNCTIONS.fun_temporal) AS new_foo FROM `test-project.FORMULAS.FORMULA_HISTORY`
,unnest(COUNTER_GROUP_INFO) as element
where SOURCE_KPI_NAME in ('A01_ACD_OUT','A01_ANSW_ERL_OUT','ETH_PORT_TRAF_BYTES');