title: PostgreSQL: Getting Strings between double Brackets
body: <p>I am new to PostgreSQL and decided to play around with it a little bit. Thus I want to extract Strings from a Marked-Up text, but I do not get the result I wanted. </p>
  
  <p>To do that I have a simple table named book and a column with a text data type called page. </p>
  
  <p>The data looks something like this:</p>
  
  <pre><code>Simon the Sorcerer is a [[teenager]] transported into a fantasy world as a 
  [[Sorcerer (person)|sorcerer]] dressed in a cloak and [[pointy hat]]; his 
  cloak and hat are purple in the first game, but change to red for the rest 
  of the series (aside from possible magical colour changes in the third game). 
  He must use his logic and magical skills to solve puzzles as he progresses 
  through the games. 
  </code></pre>
  
  <p>Now I want to extract each String between the brackets [[ ]]. But how do I do that correctly? Or is that even possible without Plug-ins?</p>
  
  <p>I tried different versions with LIKE which did not produce any results, e.g.:</p>
  
  <pre><code>SELECT * FROM book WHERE page LIKE '[[%]]';
  SELECT * FROM book WHERE page LIKE '[[teenager]]';
  ...
  </code></pre>
  
  <p>I also played a bit with regex, but I only got the whole dataset back instead of the String between the brackets:</p>
  
  <pre><code>SELECT * from book where page ~ '[^[[]+(?=\]])';
  </code></pre>
  
  <p>Is there a solution for my problem? Help will be much appreciated!</p>