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 ?> 

http://ideone.com/ourhhv


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -