title: REGEXT in MySQL query
body: <p>my regexp foo isn't the best but the following doesn't work and I'm looking for a little advice:</p>
  
  <pre><code>$query = $_GET['indicator'];
  // given: 239,240  or 240,239  or 238,239,240  
  //   and: 239, 240 or 240, 239 or 238, 239, 240
  //   and: 239
  // we need to check for start+number+puntuation(1), punctuation+number+end(2), punctuation+number+punctuation(3)
  //                                                  space+number+end(4),       space+number+punctuation(6)
  //                      start+number+end(6)
  $sql = 'SELECT * from reports WHERE dataSetIDs REGEXP \'';
  $sql .= '^'.$query.'[:punct:]|';            // 1
  $sql .= '[:punct:]'.$query.'$|';            // 2
  $sql .= '[:punct:]'.$query.'[:punct:]|';    // 3
  $sql .= '[:space:]'.$query.'$|';            // 4
  $sql .= '[:space:]'.$query.'[:punct:]|';    // 5
  $sql .= '^'.$query.'$\'';                   // 6
  $result = mysql_query($sql);
  </code></pre>
  
  <p>The query is looking at a specific cell which has CSV formatted set of numbers for which the formatting isn't set (i.e. could have spaces after the comma or not). I'm getting the rows with just one entry... but not the rows that have the number in the csv.</p>
  
  <p>Any pointers greatly appreciated.</p>
  
  <p>Cheers,</p>
  
  <p>Dom</p>