NSString* attribute_list = [wvPage stringByEvaluatingJavaScriptFromString:
@"var attrs=document.getElementsByClassName('attributes-list')[0].innerHTML;attrs = attrs.replace(/(?:<\!\-\-[^\-]*\-\->|<li[^>]*>| |\ )/ig, '');attrs = attrs.replace(/<\/li[^>]*>/ig, '|');"];
Above is my code. I want to do replace in JavaScript.
Things work fine, but I’m getting warnings. How can I ban these warnings?
Unknown escape sequence '\!'
Unknown escape sequence '\-'
...
and things like this.
You are using a string
@""which allows special escaped characters (e.g. think of how\nmagically becomes a new-line). This means every backslash in your code that is not meant to be parsed in this way must be doubled so that it is kept verbatim.For example: