Combining several REGEX functions in one formula?

Is it possible to combine several REGEX functions in one formula?

Currently, I have this setup:

In column A, there is some text that needs modifying
In columns B to E, a formula references columns A to D and does the modifying

So A1 reads
mbyz <i>truez</i> E,{shbow |sorbt }J.tbexzt

Finally, E1 reads
my true E sort J_text

Is it possible to do the complete modifying in column B alone, with one formula? Or is it necessary to use 4 columns?

See the attached file.
combine.ods (9.1 KB)

If I did such a conversion, then instead of the last two REGEX (replacing a comma with a space and replacing a dot with an underscore), I would use the usual SUBSTITUTE():

=SUBSTITUTE(SUBSTITUTE(REGEX(REGEX(A1;"\{.*?\|(.*?)\}";"$1";"g");"</?\S+?>|[bz]";"";"g");".";"_");",";" ")
1 Like

This is fantastic!

REGEX or SUBSTITUTE – when do you use which?

Well, I write down both options and see which one is shorter. SUBSTITUTE() uses “.” and “_”, and REGEX() needs “.”, “_” and “g” - so the choice is in favor of SUBSTITUTE.

2 Likes

Also, REGEX() has a much higher runtime cost than SUBSTITUTE().

3 Likes