Search code examples
regexgoogle-sheetsgoogle-sheets-formulaarray-formulastextjoin

RegEx with Google Sheets, Matching Items With Delimiter


Starting with this

za%3A0%2Cca%3A3-2-1-21-1%2Cus%3Apa%2Cus%3Anj

Get this

(id:za%3A0),(id:ca%3A3-2-1-21-1),(id:us%3Apa),(id:us%3Anj)

%2C is the delimiter in the starting string. Not always going to be 4 ids, could be 1 could be 70.

First problem I'm having since I'm new to RegEx is how to "match" all ids (ex. za%3A0) based on the delimiter.


Solution

  • try:

    =ARRAYFORMULA(TEXTJOIN(",", 1, "(id:"&SPLIT(SUBSTITUTE(A644, "%2C", "♦"), "♦")&")"))
    

    0