Extract one code from two dimensions

Hi, i need to extract one code (“PB”) from two differents dimensions (“Campaña” and “Grupo de Anuncios”)

Something like this:

REGEXP_EXTRACT((Campaña) OR (Grupo de anuncios,(‘PB~(.+?)_’))

“Campaña” is build like the following: BR~Nike_CN~aon_PB~google-search_OB~trafico_FF~aon-upper-funnel, and “Grupo de Anuncios” is similar.

The formula that i’v tried is wrong … i need help please.

Hi @Mario_Sarah

Give a try with the following

Regex.Match(strInput, "PB~([^_]+)").Value

image

Regards