0

i have to find this chars sequence "<div" I use this pattern: "/\<div/" but the result array for preg_match is null: Array ( [0] =>

$domObject = "iajsdijasidijsad<div class=\"_3-ma _2bne\">`</div>sidjiasdjiasjdiasjid";`
$pattern = '/\<div/';
preg_match($pattern, $domObject, $result);
print_r($result);
Armando Alberti
  • 103
  • 2
  • 14
  • 1
    Possible duplicate of [Why it's not possible to use regex to parse HTML/XML: a formal explanation in layman's terms](http://stackoverflow.com/questions/6751105/why-its-not-possible-to-use-regex-to-parse-html-xml-a-formal-explanation-in-la) – mkierc Dec 28 '15 at 16:27
  • and you don't need any escape caracter here : http://www.regexpal.com/?fam=93744 – Emrys Myrooin Dec 28 '15 at 16:33
  • That's not even valid PHP code. Can you please edit the question and clean up the code? Whatever, your haystack does not seem to have any `\<` string. Do you mean `` by chance? – Álvaro González Dec 28 '15 at 17:15

0 Answers0