title: Trying to loop through all cells that start with the contents of another cell using ARRAYFORMULA and RegExMatch
body: <p>I have a Google Spreadsheet setup; it's for a product import. I am trying to loop through all rows, when C2:C == "configurable" I want it to join (with a comma) all B2:B cells that start with the contents of B in the current "configurable" row.</p>
  
  <p>For example, the table may look like <a href="https://docs.google.com/spreadsheets/d/1_DXkwL2eGockNFzgNNcvz0Tlk7wmhPgNDM4A6azrUac/edit?usp=sharing" rel="nofollow">this.</a></p>
  
  <pre><code>Name    |  SKU     |  Type           |  Simple Products
  Prod 1  |  001     |  configurable   |  001.01,001.02
  Prod 2  |  001.01  |  simple         |
  Prod 3  |  001.02  |  simple         |
  Prod 4  |  002     |  configurable   |  002.01,002.02,002.03
  Prod 5  |  002.01  |  simple         |
  Prod 6  |  002.02  |  simple         |
  Prod 7  |  002.03  |  simple         |
  </code></pre>
  
  <p>The "Simple Products" column (D2) is where the formula would be located. It will scan each row, if C* = configurable, then it will use the B* value to find all "simple" SKUs that start with the value in B*.</p>
  
  <p>I have it almost working, using the following formula:</p>
  
  <pre><code>=ARRAYFORMULA( 
      IF( 
          C3:C="configurable", 
  
          join(
              ",", 
              transpose(
                  iferror(
                      filter(
                          B3:B,
                          C3:C="simple",
                          RegExMatch(B3:B, B3)
                      )
                  )
              )
          ), 
  
          "" 
      ) 
  )
  </code></pre>
  
  <p>However, the above always uses B3 for the RegExMatch, so every configurable row contains <code>001.01,001.02</code> rather than the row it is currently outputting data in.</p>