Forum Discussion

anupambit1797's avatar
anupambit1797
Iron Contributor
Sep 16, 2025

REGEX+TEXTSPLIT

Dear Experts,

              I have a data like below in column"A":-

And , I want to split it in the way like in "Yellow" So, after each consecutive Alphabet or number it should be splitted, I tried to do something in Column "B" but not succesful. Could you please share any solution if possible by using a comb of regex + textsplit?

Thanks in Advance,

Br,

Anupam

     

5 Replies

  • RedNectar's avatar
    RedNectar
    Brass Contributor

    Hi anupambit1797​ ,

    On the shoulders of giants... or in this case m_tarler​ 's shoulders.

    Try:

    =TEXTSPLIT(LET(a,REGEXEXTRACT(A2,"([A-Z0-9])",1,1),CONCAT(a&IF(a=HSTACK(DROP(a,,1),""),",",""))),",")

    to get what you want - at least what I THINK you want

     

  • peiyezhu's avatar
    peiyezhu
    Bronze Contributor

    select *,regreplace('(.)(?=\1)','\1,',id) from Sheet2;

     

    • peiyezhu's avatar
      peiyezhu
      Bronze Contributor

      https://support.microsoft.com/en-us/office/regexreplace-function-9c030bb2-5e47-4efc-bad5-4582d7100897

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    I'm not good with REGEX so this is probably more complicated than needed but seems to work:

    =LET(a,REGEXEXTRACT(A2,"([A-Z0-9])",1,1),CONCAT(a&IF(a=HSTACK(DROP(a,,1),""),",","")))

Resources