0

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

Edited by Buppy: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.