A quick question - i have a string containing text like this:

\\u003cspan class=\\\"someClass\\\">Some text\\u003c\\\/span>

How do i get that "Some text" value into an array? I tried

preg_match_all("/\\\\u003cspan class=\\\\\\\"someClass\\\\\\\">(.*?)\\\\u003c\\\\\\/span>/",$str,$res);

Returns nothing. I think there's something wrong with the regex pattern. Maybe anyone can correct me?


My tool shows a match:

preg_match_all('%\\\\\\\\u003cspan class=\\\\\\\\\\\\"someClass\\\\\\\\\\\\">(.*?)\\\\\\\\u003c\\\\\\\\\\\\/span>%s', $subject)

The backslash needs to be escaped in the regex (which you did), but also in the string (which you did not).