How to remove comment HTML element in a String in iOS -
this last part of string:
</div>  </noscript><!-- g3.js-t oldalanként egyszer, </body> zárótag előtt kell meghívni -->  <script type="text/javascript" charset="utf-8" src="//ad.adverticum.net/g3.js"></script>              <div id="autosuggest"><ul></ul></div>      </body>  </html> and how want remove comment element, not work:
var regex = nsregularexpression(pattern: "<!--[^<]*-->", options: nsregularexpressionoptions.caseinsensitive, error: nil)! str = regex.stringbyreplacingmatchesinstring(str, options: nil, range: nsmakerange(0, count(str)), withtemplate: "") any idea why?
you can try using different regex:
var regex = nsregularexpression(pattern: "<!--[\\s\\s]*-->", options: nsregularexpressionoptions.caseinsensitive, error: nil)! 
Comments
Post a Comment