removing whitespaces



Hello,

I try to remove whitespaces from a string using the preg_replace function
like

preg_replace("/[\t ][\t ]*/"," ",$string);

This works great, but makes no handles all characters in the same way. I
want to preserve data between double quotes. So,
hello world "It is a sunny... world"
shall be reduced to
hello world "It is a sunny... world"

and should not remove the whitespaces between the quotes.

Can someone help me ?

Thanks in advance

Richard


.



Relevant Pages

  • Re: Open, Close, & Freefile
    ... statement adds characters such as quotes around string data. ... Write #fnum, "This is some text..." ... VB writes out the quotes whether a literal or in a variable. ... It is imo on the same line as using the trailing "$" on string intrinsics to ensure the character version is returned as opposed to Variant when that is what is intended, etc., ... ...
    (microsoft.public.vb.general.discussion)
  • Mandis Quotes (aka retiring """ and )
    ... arbitrary textual matter called "Mandis quotes". ... surround the string by a pair of doubled single quotes. ... of ASCII or Unicode characters, but instead as a sequence of lines ...
    (comp.lang.python)
  • Re: Commodore 128 Basic 7.0 One Liner Competition 2008
    ... the characters in the string and put them into memory. ... You could put a REM statement at the end of the line with a bunch ... of characters in quotes and have a SYS command at the beginning of the ...
    (comp.sys.cbm)
  • Re: list or not a list?
    ... grouping character of quotes inside a string, that is used as a list. ... I thought, that the blank-separated characters in the string, treated ... as list, will be recognized as list elements, but I can't really ...
    (comp.lang.tcl)
  • Re: "Reversed" LCS problem
    ... have to worry so much about defining "substring" versus "subsequence," ... say "the letters in the string must be next to each other, ... >> has the lowest number of common characters from the other strings, ... > No whitespaces, no sequences, only substrings. ...
    (comp.programming)