Hi,

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?

Thanks

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.