title: In Swift, how to write the regular expression to remove URLs in a string?
body: <p>I am trying to remove any URL within a string, and there is a <a href="https://stackoverflow.com/a/24589203/830098">SO answer</a> that provides a solution using regular expression in PHP:</p>
  
  <pre><code>$regex = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@";
  echo preg_replace($regex, ' ', $string);
  </code></pre>
  
  <p>I tried directly in Swift as:</p>
  
  <pre><code>myStr.stringByReplacingOccurrencesOfString("@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@", withString: "", options: .RegularExpressionSearch)
  </code></pre>
  
  <p>but it shows some error <code>Invalid escape sequence in literal</code>.</p>
  
  <p>How to do it correctly in Swift? </p>