(^/"; $ex1="/^(^*)()(^*)$/i"; $data = preg_replace_callback($exp, create_function('$matches','return $matches1. Str_replace(" "," ",$matches2);'), $data); $data = preg_replace_callback($ex1, create_function('$matches','return str_replace(" "," ",$matches1). $matches2;'), $data); $data = preg_replace_callback($ex2, create_function('$matches','return $matches1.
Str_replace(" "," ",$matches2);'), $data); echo $data;? It works... slightly modified but it would work without modifications (but I don't think youd understand the code ;) ).
(^ it works... slightly modified but it would work without modifications (but I don't think youd understand the code ;) ).
This regex not working for me. Maybe mistake? – Pro85 Mar 6 at 12:47 how is it not working for you?
-. -'''' what function do you use? – n00b Mar 6 at 12:48 I provided working php code.
Tell me if you have further problems – n00b Mar 6 at 13:36 n00b32 I run you code. Result - changed data outside html tags. Table til content spaces.
I use php 5.3.5 – Pro85 Mar 6 at 13:39 if you remove the second and third line begginin with '$data =' the code does exactly what you posted in your question... I use php 5.2.6-1+lenny9 so I think its consistent with your version – n00b Mar 6 at 13:45.
Since tokenizing HTML with regular expressions can be quite complicated (especially when allowing SGML quirks), you should use an HTML DOM parser like the one of PHP’s DOM library. Then you can query the DOM, get all text nodes and apply your replacement function on it: $doc = new DOMDocument(); $doc->loadHTML($str); $body = $doc->getElementsByTagName('body')->item(0); mapOntoTextNodes($body, function(DOMText $node) { $node->nodeValue = str_replace(' ', ' ', $node->nodeValue); }); The mapOntoTextNodes function is a custom function I had defined in How to replace text URLs and exclude URLs in HTML tags?
And if we are to overkill it we need to detect style/script etc etc tags... – n00b Mar 6 at 12:07 I don't need to parse all html file. I need parse some parts like I posted in question. – Pro85 Mar 6 at 12:36.
If you're working with php, you can do $content = str_replace(' ', ' ', $content).
This code replace spaces inside html tags too. – Pro85 Mar 6 at 11:54 all spaces within attributes of html tags will be replaced as well – thephpdeveloper Mar 6 at 11:54.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.