This is beginning to get into PHP themed thread
but you are right, I meant to use a 3 instead of a two in my example. I replaced it with , because when I use ' ' like in your example my PHP seems to automatically condense sets of spaces to just one. I found a reason to be able to keep that extra bit of whitespace so I used this line of code:
PHP Code:
$summary[$i]=preg_replace('/((\040){2,2})/'," ",$summary[$i]);
The reason being that it will replace every set of two spaces as opposed to any ol' whitespace with '  ' which is then displayed as two spaces occurring together. If there are 3 spaces the first two will be replaced and the third will just be tacked onto the end. Thus all spaces are now displayed from a document.
I am still new to the PCRE aspect of PHP and line terminators is a new term for me, unless you are talking about newline and carriage returns. I was accidentally removing line terminators in my displayed documents and it was getting annoying, which is why I used the above code.
At this point it might be good to split the topic, but... could you use [^\W\r\n] in a sentence? If I am reading it right the script would recognize and replace all whitespace except for \r\n. Is that correct?
Bookmarks