title: Check for Apostrophe in Regex Pattern in Element Added with jQuery (Single-Quote in Single-Quote in Double-Quote)
body: <p>I am trying to create an input for a company name using jQuery. I am also using the <a href="http://1000hz.github.io/bootstrap-validator/" rel="nofollow noreferrer">Bootstrap Validator plugin by 1000hz</a> in order to add validation for this input. I am specifically trying to use the "pattern" attribute in order to validate the input with a regex. An example of what I'm trying to accomplish is below:</p>
  
  <pre><code>var name = "&lt;input type='text' pattern='^[a-zA-Z0-9]+(?:[&amp;'\-. ]+[a-zA-Z0-9., ]+)*$'&gt;";
  
  ....
  
  $("#list").after(name);
  </code></pre>
  
  <p>I'm trying to include an apostrophe into the pattern so that a company name like "McDonald's" would be valid. However, since the pattern is within single-quotes the symbol winds up being treated as the end of the pattern string. I can't use double-quotes because they're being used for the variable, and trying to use escape characters doesn't change it from being treated as the end of the string.</p>
  
  <p>Does anyone know how I go about fixing this?</p>