in reply to global whitespace delete
Some DB scripting languages have a truly horrific way of doing it, but the basics are the same. In terms of a regex, you are looking for a quote, zero or more non-quote or delimited quote characters, and the terminating quote. You can easily change the delimited quote character bit to suit your fancy." \" " " "" "
s/((?:"(?:\\"|[^"])*?")|(?:'(?:\\'|[^'])*?'))|(\s+)/$2?" ":$1/ge;Here is what it did to my test data:
If you weren't concerned about delimited quotes, as HTML has no such thing, really, then you could use a simplified version of same:A language by "any other \"name\"", would it smell as sweet? A language by "any other \"name\"", would it smell as sweet?
s/((?:"[^"]*?")|(?:'[^']*?'))|(\s+)/$2?" ":$1/ge;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: global whitespace delete
by physi (Friar) on Jul 31, 2001 at 13:21 UTC | |
by tadman (Prior) on Jul 31, 2001 at 14:27 UTC |