Find the whole HTML element in iOS

I have huge HTML, but at a certain level there are 10 elements article. I need a theme.

<article class="box-product-big box-product-full clearfix" >
    <div class="list-left">

        <div class="cover">
            <a id="book_cover_3100529" href="/film/fritz_lang.m-egy-varos-keresi-a-gyilkost-dvd.html">
                                                            <img src="http://s06.static.libri.hu/cover/d4/3/1090228_3.jpg" alt="Fritz Lang - M- Egy város keresi a gyilkost - DVD"/>
                                                </a>
                                </div>
        <div class="desc">
            <a class="book-title" href="/film/fritz_lang.m-egy-varos-keresi-a-gyilkost-dvd.html">

..

</article>

Here is the DOM link:

enter image description here

With the following template, I try to get them, but the zero part is returned:

var error: NSError?
let pattern = "<article class=\"box-product-big box-product-full clearfix\">[\\S\\s]*?</article>"
var regex = NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions.CaseInsensitive, error: &error)!
if error != nil {
    println(error)
}
let a = regex.matchesInString(str, options: NSMatchingOptions.ReportCompletion, range: NSMakeRange(0, count(str)))

Any idea what's wrong?

Data is taken here: http://www.libri.hu/talalati_lista/?text=m


I tried with a different escaping, but getting an error:

enter image description here

String literals can include the following special characters: escaped special characters \ 0 (null character), \ (backslash), \ t (horizontal tab), \ n (string), \ r (carriage return), \ "(double quote ) and \ '(single quote)

doc

+4
source share
1 answer

/, , \/:

let pattern = "<article class=\"box-product-big box-product-full clearfix\">[\\S\\s]*?<\/article>"
                                                  Escape slash with backslash ---------^

documentation:

, , *? + [() {} ^ $| \./

enter image description here

Btw, :

<article[\S\s]*?<\/article>

var error: NSError?
let pattern = "<article[\\S\\s]*?<\/article>"
var regex = NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions.CaseInsensitive, error: &error)!
if error != nil {
    println(error)
}
let a = regex.matchesInString(str, options: NSMatchingOptions.ReportCompletion, range: NSMakeRange(0, count(str)))

, :

(<article[\S\s]*?<\/article>)
+3

All Articles