How can I extract strings in a pattern from within another regex pattern Exemple:
REGEXREPLACE("Ex.: <a;b;c;> e <d;e;>.","<(.*?)>","($1)...")
to get
Ex: (a)(b)(c) e (d)(e).
How can I extract strings in a pattern from within another regex pattern Exemple:
REGEXREPLACE("Ex.: <a;b;c;> e <d;e;>.","<(.*?)>","($1)...")
to get
Ex: (a)(b)(c) e (d)(e).
You can try a nested REGEXREPLACE
functions then use SUBSTITUTE
at the end like this sample below:
=SUBSTITUTE(REGEXREPLACE
(REGEXREPLACE
(REGEXREPLACE
("<a;b;c;> e <d;e;>.", "<(.*?)>", "($1)"),
"[^a-z()> .a-z]", ")*("),
"[^a-z()> .a-z]",""),
"()","")
Sample string is on cell
A2
E.g. placed on cell
A2
=REGEXREPLACE("<a;b;c;> e <d;e;>.", "<(.*?)>", "($1)")
Result:
(a;b;c;) e (d;e;).
;
with )*(
:=REGEXREPLACE(A2, "[^a-z()> .a-z]", ")*(")
Result:
(a)*(b)*(c)*() e (d)*(e)*().
=REGEXREPLACE(B2,"[^a-z()> .a-z]","")
Result:
(a)(b)(c)() e (d)(e)().
()
using [SUBSTITUTE][2]
function:=SUBSTITUTE(C2,"()","")
Result:
(a)(b)(c) e (d)(e).