title: Escaping parentheses in XPATH (document.evaluate)
body: <p>I am using the following code to iterate over all DOM elements that contain a phone number.  This code works when the phone number string being searched for does not have any parentheses in it, but I assume the parentheses is messing up the XPATH contains() function.  Does anyone have any idea on how I can escape these parentheses to make the code work again?</p>
  
  <pre><code>var oldPhoneNumber = '(123) 456-7890';
  if (document.evaluate) {
      var nextElement = document.evaluate("//text()[contains(.,\"" + oldPhoneNumber + "\")]", document, null, XPathResult.ANY_TYPE, null).iterateNext();
      while (nextElement) {
          nextElement = document.evaluate("//text()[contains(.,\"" + oldPhoneNumber + "\")]", document, null, XPathResult.ANY_TYPE, null).iterateNext();
      }
  }
  </code></pre>
  
  <p>Thanks!</p>