Search code examples
regexgoogle-sheetsgoogle-sheets-formulare2

Google spreadsheets RE2 / RegEx - return all alpha words in string


I'm trying to extract alpha sequences in strings in Google spreadsheets.

My sequences are like 75% Cotton, 15% Organic wool, 10% Polyurethane. My desired output would be Cotton, Organic wool, Polyurethane

I tried =REGEXEXTRACT(A1; "([a-zA-Z ]+),") which gives me only the first occurrence Cotton. This seems to be a known limitation. Is there another chance to get the desired result?


Solution

  • You can match 1+ digits preceded by a word boundary \b[0-9]+ followed by % and a space and replace that with an empty string.

    =REGEXREPLACE(A1, "\b\d+% ", "")
    

    enter image description here