title: preg_quote and escaping single quotes
body: <p>I am trying to match Artist Names in Event Titles using a regular expression. My Artist Names can contain a wide variety of characters. I am using preg_quote() to escape special characters for my regular expression.</p>
  
  <p>When my string doesn't contain any quotes, this is fine. But, when it does, I encounter problems.</p>
  
  <p>For the following string:</p>
  
  <p><code>80's VS 90's Party Featuring Stifler's Mom (the Ultimate 90's Experien</code></p>
  
  <p>a combination of </p>
  
  <p><code>addslashes(preg_quote($str))</code></p>
  
  <p>...produces the following error:</p>
  
  <p><code>Message: preg_match(): Compilation failed: missing ) at offset 94</code></p>
  
  <p>If I remove addslashes(), then my regular expression fails later on the following subject string:</p>
  
  <p><code>Kruger Gallery's Garza Marfa Furniture &amp; Textile Design Opening Reception</code></p>
  
  <p>...producing the following error:</p>
  
  <p><code>Message: preg_match(): Unknown modifier 'G'</code></p>
  
  <p>How can I compose a regular expression that will tolerate the presence of any special characters, in combination with single and/or double quotes?</p>
  
  <p>At present, my regular expressions are compiled a loop, for each artist I test, with this:</p>
  
  <pre><code>$pattern = "'`\b" . addslashes(preg_quote($artist_name, '`')) . "\b`'";
  </code></pre>
  
  <p>I'm using the back tick as a delimiter because they appear to be the least likely character to be encountered in my artist names.</p>