regex - PHP regular expressions and XML -
i have xml database of 17000 records not formed. problem xml attributes not in quotes ("").
my script collects 1 record.
the problem put attribute values within quotes.
so if have string like:
$str = "this test id=abc> string"; $str1 = '="'; $str2 = str_replace("=", $str1, $str);
my problem to attribute value within quotes (id="abc">
). tried using regular expressions, didn't work.
<?php $string = "this test id=abc> string"; $replace = preg_replace('/=([\w]+)/i', '="$1"', $string ); echo $replace ; //this test id="abc"> string ?>
Comments
Post a Comment