title: How to join tables on regex
body: <p>Say I have two tables msg for messages and mnc for mobile network codes.
  They share no relations. But I want to join them</p>
  
  <pre><code>SELECT msg.message,
      msg.src_addr,
      msg.dst_addr,
      mnc.name,
  FROM "msg"
  JOIN "mnc"
  ON array_to_string(regexp_matches(msg.src_addr || '+' || msg.dst_addr, '38(...)'), '') = mnc.code
  </code></pre>
  
  <p>But query fails with error:</p>
  
  <pre><code>psql:marketing.sql:28: ERROR:  argument of JOIN/ON must not return a set
  LINE 12: ON array_to_string(regexp_matches(msg.src_addr || '+' || msg...
  </code></pre>
  
  <p>Is there a way to do such join? Or am I moving wrong way?</p>