Read the file and replace the regular expression ??. Reading files, regular expression replacement ?? I want to replace the 2.xmlin the attachment with a regular expression, so that it becomes the following :( in fact, it is to change the label) that is to let the programmingRasmusLerdorfKevinTatroe1-5 read the file, regular expression replacement ??
I want to replace 2.xmlin the attachment with a regular expression to make it as follows: (actually, the label is changed)
That is, let
Programming
Rasmus Lerdorf
Kevin Tatroe
1-56592-610-2
A greate book!
Replace
Programming
Rasmus Lerdorf
Kevin Tatroe
1-56692-610-2
Actually, it is to replace the tag, and the value remains unchanged.
How can I write this program? How can I replace the regular expression before reading the file? In addition, how can xml labels be written as regular expressions? Thank you.
Let me answer
Attachment: you cannot download or view attachments in your user group.
D8888D reply content -------------------------------------------------------
$ Ftext = file_get_contents ($ filename );
Preg_replace ('replacement string regular expression', 'replacement content', $ ftext );
D8888D reply content -------------------------------------------------------
Do you want to write more str_replace ..
D8888D reply content -------------------------------------------------------
Is this correct:
$ Xml = "books. xml ";
$ F = fopen ('books. XML', 'r ');
While ($ data = fread ($ f, 4096) {$ xml. = $ data ;}
Fclose ($ f );
$ Xmla = preg_replace ('/ ', 'Lil', $ xml );
$ Xmla = preg_replace (' ','/Lil', $ xmla );
Echo "$ xmla ";
?>
D8888D reply content -------------------------------------------------------
Is this correct:
Lxcupid published on [url = http://bbs.111cn.cn/redirect.php? Goto = findpost & pid = 1068481 & ptid = 128175] link Mark [img] http://bbs.111cn.cn/images/common/back.gif?/img=#/url]
$ Xml = implode ("", file ('books. XML '));
$ Xmla = preg_replace ('/ ', 'Lil', $ xml );
$ Xmla = preg_replace (' ','/Lil', $ xmla );
Echo "$ xmla ";
?>
D8888D reply content -------------------------------------------------------
$ Xml = implode ("", file ('books. XML '));
$ Xml = str_replace (array (' ',' '), Array (' ',' '), $ Xml); // Set Replace , Set Replace
D8888D reply content -------------------------------------------------------
Thank you, but it seems that some textures are missing. However, the result is not a new xml format.
D8888D reply content -------------------------------------------------------
The following code is as follows:
$ Xml = implode ("", file ('books. XML '));
$ Data = str_replace (array (' ',' '), Array (' ',' '), $ Xml );
// Set Replace , Set Replace
Echo $ data;
?>
However, the running result is:
Rasmus Lerdorf Kevin Tatroe 1-56592-610-2
Why cannot I display the new xml file I want ??
Attachment: you cannot download or view attachments in your user group.
D8888D reply content -------------------------------------------------------
Htmlentities () output with this function
D8888D reply content -------------------------------------------------------
Please provide more details. thank you.
Why ?? I want to replace 2.xmlin the attachment with a regular expression, and change it to the following: (actually, change the label) that is, let programming Rasmus Lerdorf Kevin Tatroe 1-5...