FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » reduce all spaces to one
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
reduce all spaces to one [message #176896] Fri, 03 February 2012 19:03 Go to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Hello everybody,

what would be in PHP the equivalent of the VB .NET statement

Text = Regex.Replace(Text, "[ ]+", " ")

in order to reduce to one all the spaces between words (chr(32)) ???

Thanks for the hints.
Re: reduce all spaces to one [message #176897 is a reply to message #176896] Fri, 03 February 2012 19:36 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/3/2012 2:03 PM, John wrote:
> Hello everybody,
>
> what would be in PHP the equivalent of the VB .NET statement
>
> Text = Regex.Replace(Text, "[ ]+", " ")
>
> in order to reduce to one all the spaces between words (chr(32)) ???
>
> Thanks for the hints.
>
>

Try

$text = preg_replace('/\s+/', ' ', $text);


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176898 is a reply to message #176897] Fri, 03 February 2012 20:05 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
On 02/03/2012 12:36 PM, Jerry Stuckle wrote:
> On 2/3/2012 2:03 PM, John wrote:
>> Hello everybody,
>>
>> what would be in PHP the equivalent of the VB .NET statement
>>
>> Text = Regex.Replace(Text, "[ ]+", " ")
>>
>> in order to reduce to one all the spaces between words (chr(32)) ???
>>
>> Thanks for the hints.
>>
>>
>
> Try
>
> $text = preg_replace('/\s+/', ' ', $text);

or,

$text = str_replace(" ", " ", $text);
Re: reduce all spaces to one [message #176899 is a reply to message #176898] Fri, 03 February 2012 20:17 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/3/2012 3:05 PM, crankypuss wrote:
> On 02/03/2012 12:36 PM, Jerry Stuckle wrote:
>> On 2/3/2012 2:03 PM, John wrote:
>>> Hello everybody,
>>>
>>> what would be in PHP the equivalent of the VB .NET statement
>>>
>>> Text = Regex.Replace(Text, "[ ]+", " ")
>>>
>>> in order to reduce to one all the spaces between words (chr(32)) ???
>>>
>>> Thanks for the hints.
>>>
>>>
>>
>> Try
>>
>> $text = preg_replace('/\s+/', ' ', $text);
>
> or,
>
> $text = str_replace(" ", " ", $text);
>

Doesn't work - try it with 'abc def ghi jkl'.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176900 is a reply to message #176898] Fri, 03 February 2012 20:19 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 03.02.2012 21:05, schrieb crankypuss:
> On 02/03/2012 12:36 PM, Jerry Stuckle wrote:
>> On 2/3/2012 2:03 PM, John wrote:
>>> Hello everybody,
>>>
>>> what would be in PHP the equivalent of the VB .NET statement
>>>
>>> Text = Regex.Replace(Text, "[ ]+", " ")
>>>
>>> in order to reduce to one all the spaces between words (chr(32)) ???
>>>
>>> Thanks for the hints.
>>>
>>>
>>
>> Try
>>
>> $text = preg_replace('/\s+/', ' ', $text);
>
> or,
>
> $text = str_replace(" ", " ", $text);
>

Solution shootout:

strobel@s114-intel:~> php -a
Interactive shell

php > echo str_replace(' ',' ','here are some spaces ');
here are some spaces
php > echo preg_replace('/\s+/', ' ', 'here are some spaces ');
here are some spaces
php >

The regex solution is the winner.

/Str.
Re: reduce all spaces to one [message #176901 is a reply to message #176896] Fri, 03 February 2012 20:30 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 03.02.2012 20:03, schrieb John:
> Hello everybody,
>
> what would be in PHP the equivalent of the VB .NET statement
>
> Text = Regex.Replace(Text, "[ ]+", " ")
>
> in order to reduce to one all the spaces between words (chr(32)) ???
>
> Thanks for the hints.
>
>
Interactive test:

php > echo ereg_replace('[ ]+', ' ', 'here are some spaces ');
here are some spaces
php >

It works just fine, unfortunately these functions are marked deprecated. I find the
PCRE escape sequences hard to read.

/Str.
Re: reduce all spaces to one [message #176902 is a reply to message #176900] Fri, 03 February 2012 20:59 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 03.02.2012 21:19, schrieb M. Strobel:

> Solution shootout:
>
> strobel@s114-intel:~> php -a
> Interactive shell
>
> php> echo str_replace(' ',' ','here are some spaces ');
> here are some spaces
> php> echo preg_replace('/\s+/', ' ', 'here are some spaces ');
> here are some spaces
> php>
>
> The regex solution is the winner.
>
> /Str.

OK. Thanks to all those who answered !!
Re: reduce all spaces to one [message #176903 is a reply to message #176902] Sat, 04 February 2012 14:41 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
John wrote:

> Am 03.02.2012 21:19, schrieb M. Strobel:
>> Solution shootout:
>> strobel@s114-intel:~> php -a
>> Interactive shell
>>
>> php> echo str_replace(' ',' ','here are some spaces ');
>> here are some spaces
>> php> echo preg_replace('/\s+/', ' ', 'here are some spaces ');
>> here are some spaces
>> php>
>>
>> The regex solution is the winner.
>
> OK. Thanks to all those who answered !!

It should be noted that if your question was understood literally, the
solutions presented so far would be wrong. \s would match too many
different characters, as it stands for *white-space* in PCRE, _not_ only the
space character. In order to reduce only all consecutive *space* characters
to one space character, you need to write

echo preg_replace('/ +/', ' ', "here are some \n spaces ");

Note that the newline, which is white-space too, is preserved here.

If you want to make the space character in the expression better visible,
you can use

(1) echo preg_replace('/\ +/', ' ', "here are some \n spaces ");

or

(2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces ");

or

(3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces ");

or

(4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces ");

Your approach,

echo preg_replace('/[ ]+/', ' ', "here are some \n spaces ");

is equivalent to that, but slightly less efficient because of the character
class (even in Visual Basic .NET). However, it also has the advantage over
the simple solutions (1) and (2) that multiple spaces in the character class
will still only match one space.


PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14
Re: reduce all spaces to one [message #176904 is a reply to message #176903] Sat, 04 February 2012 14:57 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
> John wrote:
>
>> Am 03.02.2012 21:19, schrieb M. Strobel:
>>> Solution shootout:
>>> strobel@s114-intel:~> php -a
>>> Interactive shell
>>>
>>> php> echo str_replace(' ',' ','here are some spaces ');
>>> here are some spaces
>>> php> echo preg_replace('/\s+/', ' ', 'here are some spaces ');
>>> here are some spaces
>>> php>
>>>
>>> The regex solution is the winner.
>>
>> OK. Thanks to all those who answered !!
>
> It should be noted that if your question was understood literally, the
> solutions presented so far would be wrong. \s would match too many
> different characters, as it stands for *white-space* in PCRE, _not_ only the
> space character. In order to reduce only all consecutive *space* characters
> to one space character, you need to write
>
> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>
> Note that the newline, which is white-space too, is preserved here.
>

Newline is preserved in my version also, if you understood ANYTHING
about how PHP's regex's work (but we already know you don't). It also
takes out tabs - which may be inserted automatically by some editors,
for instance, and can be desirable.

> If you want to make the space character in the expression better visible,
> you can use
>
> (1) echo preg_replace('/\ +/', ' ', "here are some \n spaces ");
>

The search pattern is invalid.

> or
>
> (2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces ");
>

Searches for the sequence '\ '

> or
>
> (3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces ");
>

Ugh!

> or
>
> (4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces ");
>

Again, invalid escape sequence.

> Your approach,
>
> echo preg_replace('/[ ]+/', ' ', "here are some \n spaces ");
>
> is equivalent to that, but slightly less efficient because of the character
> class (even in Visual Basic .NET). However, it also has the advantage over
> the simple solutions (1) and (2) that multiple spaces in the character class
> will still only match one space.
>
>
> PointedEars

Showing your ignorance again. You do better when you keep your mouth shut.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176905 is a reply to message #176904] Sat, 04 February 2012 15:05 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
>> John wrote:
>>> Am 03.02.2012 21:19, schrieb M. Strobel:
>>>> Solution shootout:
>>>> strobel@s114-intel:~> php -a
>>>> Interactive shell
>>>>
>>>> php> echo str_replace(' ',' ','here are some spaces ');
>>>> here are some spaces
>>>> php> echo preg_replace('/\s+/', ' ', 'here are some spaces
>>>> '); here are some spaces
>>>> php>
>>>>
>>>> The regex solution is the winner.
>>> OK. Thanks to all those who answered !!
>>
>> It should be noted that if your question was understood literally, the
>> solutions presented so far would be wrong. \s would match too many
>> different characters, as it stands for *white-space* in PCRE, _not_ only
>> the space character. In order to reduce only all consecutive *space*
>> characters to one space character, you need to write
>>
>> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>>
>> Note that the newline, which is white-space too, is preserved here.
>
> Newline is preserved in my version also,

No, it is not.

$ php -a
Interactive mode enabled

<?php

echo "|foo \n bar|";
echo preg_replace('/\s+/', ' ', "|foo \n bar|");
echo preg_replace('/ +/', ' ', "|foo \n bar|");
|foo
bar||foo bar||foo
bar|

> if you understood ANYTHING about how PHP's regex's work (but we already
> know you don't).

Stop talking to the mirror.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Re: reduce all spaces to one [message #176906 is a reply to message #176904] Sat, 04 February 2012 15:21 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Ahh, there was more nonsense to be corrected …

Jerry Stuckle wrote:

> On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
>> John wrote:
>>> Am 03.02.2012 21:19, schrieb M. Strobel:
>>>> Solution shootout:
>>>> strobel@s114-intel:~> php -a
>>>> Interactive shell
>>>>
>>>> php> echo str_replace(' ',' ','here are some spaces ');
>>>> here are some spaces
>>>> php> echo preg_replace('/\s+/', ' ', 'here are some spaces
>>>> '); here are some spaces
>>>> php>
>>>>
>>>> The regex solution is the winner.
>>>
>>> OK. Thanks to all those who answered !!
>>
>> It should be noted that if your question was understood literally, the
>> solutions presented so far would be wrong. \s would match too many
>> different characters, as it stands for *white-space* in PCRE, _not_ only
>> the
>> space character. In order to reduce only all consecutive *space*
>> characters to one space character, you need to write
>>
>> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>>
>> Note that the newline, which is white-space too, is preserved here.
>>
>
> Newline is preserved in my version also, if you understood ANYTHING
> about how PHP's regex's work (but we already know you don't).

JFYI, with preg_* methods, PHP's Regular Expressions are *Perl-Compatible*
Regular Expressions. That is what the `p' stands for there (as opposed to
ereg_*, which are now [PHP 5.3] deprecated methods using POSIX *E*xtended
Regular Expressions).

>> If you want to make the space character in the expression better visible,
>> you can use
>>
>> (1) echo preg_replace('/\ +/', ' ', "here are some \n spaces
>> ");
>>
>
> The search pattern is invalid.

Perfectly valid

$ php -v
PHP 5.3.10-1 (cli) (built: Feb 3 2012 10:03:01)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with XCache v1.3.2, Copyright (c) 2005-2011, by mOo
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

>> or
>>
>> (2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces
>> ");
>>
>
> Searches for the sequence '\ '

Not in the PHP version mentioned above.

>> or
>>
>> (3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces
>> ");
>>
>
> Ugh!

man 3 pcrepattern

>> or
>>
>> (4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces
>> ");
>>
>
> Again, invalid escape sequence.

Again, perfectly valid and working as intended in the PHP version mentioned
above. Probably valid in *all* PHP versions that support PCREs. You have
not bothered to do any tests before posting, have you?

>> Your approach,
>>
>> echo preg_replace('/[ ]+/', ' ', "here are some \n spaces
>> ");
>>
>> is equivalent to that, but slightly less efficient because of the
>> character class (even in Visual Basic .NET). However, it also has the
>> advantage over the simple solutions (1) and (2) that multiple spaces in
>> the character class will still only match one space.
>
> Showing your ignorance again. You do better when you keep your mouth
> shut.

Pot, kettle, black.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Re: reduce all spaces to one [message #176907 is a reply to message #176906] Sat, 04 February 2012 21:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/4/2012 10:21 AM, Thomas 'PointedEars' Lahn wrote:
> Ahh, there was more nonsense to be corrected …
>
> Jerry Stuckle wrote:
>
>> On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
>>> John wrote:
>>>> Am 03.02.2012 21:19, schrieb M. Strobel:
>>>> > Solution shootout:
>>>> > strobel@s114-intel:~> php -a
>>>> > Interactive shell
>>>> >
>>>> > php> echo str_replace(' ',' ','here are some spaces ');
>>>> > here are some spaces
>>>> > php> echo preg_replace('/\s+/', ' ', 'here are some spaces
>>>> > '); here are some spaces
>>>> > php>
>>>> >
>>>> > The regex solution is the winner.
>>>>
>>>> OK. Thanks to all those who answered !!
>>>
>>> It should be noted that if your question was understood literally, the
>>> solutions presented so far would be wrong. \s would match too many
>>> different characters, as it stands for *white-space* in PCRE, _not_ only
>>> the
>>> space character. In order to reduce only all consecutive *space*
>>> characters to one space character, you need to write
>>>
>>> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>>>
>>> Note that the newline, which is white-space too, is preserved here.
>>>
>>
>> Newline is preserved in my version also, if you understood ANYTHING
>> about how PHP's regex's work (but we already know you don't).
>
> JFYI, with preg_* methods, PHP's Regular Expressions are *Perl-Compatible*
> Regular Expressions. That is what the `p' stands for there (as opposed to
> ereg_*, which are now [PHP 5.3] deprecated methods using POSIX *E*xtended
> Regular Expressions).
>
>>> If you want to make the space character in the expression better visible,
>>> you can use
>>>
>>> (1) echo preg_replace('/\ +/', ' ', "here are some \n spaces
>>> ");
>>>
>>
>> The search pattern is invalid.
>
> Perfectly valid
>
> $ php -v
> PHP 5.3.10-1 (cli) (built: Feb 3 2012 10:03:01)
> Copyright (c) 1997-2012 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
> with XCache v1.3.2, Copyright (c) 2005-2011, by mOo
> with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
> with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
>
>>> or
>>>
>>> (2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces
>>> ");
>>>
>>
>> Searches for the sequence '\ '
>
> Not in the PHP version mentioned above.
>
>>> or
>>>
>>> (3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces
>>> ");
>>>
>>
>> Ugh!
>
> man 3 pcrepattern
>
>>> or
>>>
>>> (4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces
>>> ");
>>>
>>
>> Again, invalid escape sequence.
>
> Again, perfectly valid and working as intended in the PHP version mentioned
> above. Probably valid in *all* PHP versions that support PCREs. You have
> not bothered to do any tests before posting, have you?
>
>>> Your approach,
>>>
>>> echo preg_replace('/[ ]+/', ' ', "here are some \n spaces
>>> ");
>>>
>>> is equivalent to that, but slightly less efficient because of the
>>> character class (even in Visual Basic .NET). However, it also has the
>>> advantage over the simple solutions (1) and (2) that multiple spaces in
>>> the character class will still only match one space.
>>
>> Showing your ignorance again. You do better when you keep your mouth
>> shut.
>
> Pot, kettle, black.
>
>
> PointedEars

Your ability to state the obvious is only exceeded by your stoopidity
and ability to confuse a simple issue.

No one here gives a damn about your ability to cut and paste answers
just to try to prove you know something. We know you don't - just like
in other usenet newsgroups.

And we know that lack of appreciation for your stoopidity riles you to
no end.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176908 is a reply to message #176903] Sat, 04 February 2012 21:26 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 04.02.2012 15:41, schrieb Thomas 'PointedEars' Lahn:

>
> It should be noted that if your question was understood literally, the
> solutions presented so far would be wrong. \s would match too many
> different characters, as it stands for *white-space* in PCRE, _not_ only the
> space character. In order to reduce only all consecutive *space* characters
> to one space character, you need to write
>
> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>
> Note that the newline, which is white-space too, is preserved here.
>

in fact, just by 'accident' the 'regex' solutions fits perfectly in what
I have to do next, i.e. feed the text through an 'explode' statement,
which takes ' ' as separator.
Re: reduce all spaces to one [message #176909 is a reply to message #176908] Sat, 04 February 2012 23:05 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
John wrote:

> Am 04.02.2012 15:41, schrieb Thomas 'PointedEars' Lahn:
^^^^^^^
>> It should be noted that if your question was understood literally, the
>> solutions presented so far would be wrong. \s would match too many
>> different characters, as it stands for *white-space* in PCRE, _not_ only
>> the space character. In order to reduce only all consecutive *space*
>> characters to one space character, you need to write
>>
>> echo preg_replace('/ +/', ' ', "here are some \n spaces ");
>>
>> Note that the newline, which is white-space too, is preserved here.
>
> in fact, just by 'accident' the 'regex' solutions fits perfectly in what
> I have to do next, i.e. feed the text through an 'explode' statement,
> which takes ' ' as separator.

I do not think you have fully understood what I have said (maybe you want to
try posting to *de*.comp.lang.php instead?). *All* presented solutions so
far, including yours and mine, are "'regex' solutions". But the set of
characters that are replaced differs between them.

Anyhow, you do not need to replace spaces before word splitting. Instead of
PHP 5+ [1]

$words = str_split(' ', preg_replace('/\\s+/', ' ', $text));

since PHP 4 you can just split at consecutive white-space [2]:

$words = preg_split('/\\s+/', $text);

Also note that for finding the *words* in a text, this splitting at white-
space is _not_ sufficient. For example, in the sentence before splitting at
white-space would have resulted in words "text," "_not_", and "sufficient.".
Once you use preg_split(), though, there is a simple remedy (which can be
found at [2]). Just include all characters that you do not want to be part
of a word in the character class:

$words = preg_split('/[\\s,]+/', $text);

(I prefer to write `\\' instead of `\' even within single-quoted strings, in
order to make the `\' explicit. YMMV.)

You might also want to exclude periods (`.') and other punctuation from
words, like dashes and ellipses. Note that PCRE provides an escape sequence
for ASCII-non-word characters [3], and that it supports Unicode character
properties, which can be used to differentiate between letters and non-
letters in various natural languages [4].

You might find [5] useful, in particular [6], for the next time that you
post (translations are available there).


PointedEars
___________
[1] <http://php.net/str_split>
[2] <http://php.net/preg_split>
[3] <http://php.net/manual/en/regexp.reference.escape.php>
[4] <http://php.net/manual/en/regexp.reference.unicode.php>
[5] <http://catb.org/esr/faqs/smart-questions.html>
[6] <http://catb.org/esr/faqs/smart-questions.html#goal>
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: reduce all spaces to one [message #176910 is a reply to message #176909] Sun, 05 February 2012 00:39 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>
> I do not think you have fully understood what I have said (maybe you want to
> try posting to *de*.comp.lang.php instead?). *All* presented solutions so
> far, including yours and mine, are "'regex' solutions". But the set of
> characters that are replaced differs between them.
>

Thanks for the suggestions and advice : however I hope my english is
adequate enough to make myself understood in this NG :-))

>
> $words = str_split(' ', preg_replace('/\\s+/', ' ', $text));
>

I have the problem of 'filtering' a text file, exported from Excel as a
'Windows text file with <return>', containing <tabs> between numbers.
So, besides converting all comma to points, I have to get rid af all
<tabs> and after that, reduce all spaces between words to one space.

So far its working : I have used the preg_split first with /\t/ then
/\s+/ in two separate steps. No problem so far.
If they arise, I'll come back again.

>
> You might also want to exclude periods (`.') and other punctuation from
> words,

I can't. I need the numbers and they may be decimals with points.

> You might find [5] useful, in particular [6], for the next time that you
> post (translations are available there).
>

Thanks very much indeed for the most exhaustive answer ! I am happy
I've found this place.

Thanks and best regards to all who contributed to the thread.

John.
Re: reduce all spaces to one [message #176911 is a reply to message #176910] Sun, 05 February 2012 01:56 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/4/2012 7:39 PM, John wrote:
> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>
>> I do not think you have fully understood what I have said (maybe you
>> want to
>> try posting to *de*.comp.lang.php instead?). *All* presented solutions so
>> far, including yours and mine, are "'regex' solutions". But the set of
>> characters that are replaced differs between them.
>>
>
> Thanks for the suggestions and advice : however I hope my english is
> adequate enough to make myself understood in this NG :-))
>
>>
>> $words = str_split(' ', preg_replace('/\\s+/', ' ', $text));
>>
>
> I have the problem of 'filtering' a text file, exported from Excel as a
> 'Windows text file with <return>', containing <tabs> between numbers.
> So, besides converting all comma to points, I have to get rid af all
> <tabs> and after that, reduce all spaces between words to one space.
>
> So far its working : I have used the preg_split first with /\t/ then
> /\s+/ in two separate steps. No problem so far.
> If they arise, I'll come back again.
>

The /\s+/ will also get rid of tabs, converting all white space to a
single blank.

Perhaps a better option would be to export the file as a .csv and use
fgetcsv(). It will save you a lot of work.


>>
>> You might also want to exclude periods (`.') and other punctuation from
>> words,
>
> I can't. I need the numbers and they may be decimals with points.
>
>> You might find [5] useful, in particular [6], for the next time that you
>> post (translations are available there).
>>
>
> Thanks very much indeed for the most exhaustive answer ! I am happy I've
> found this place.
>
> Thanks and best regards to all who contributed to the thread.
>
> John.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176912 is a reply to message #176910] Sun, 05 February 2012 02:15 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
John wrote:

> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>> $words = str_split(' ', preg_replace('/\\s+/', ' ', $text));

That is _not_ what I *recommended*. Please learn to quote.

> I have the problem of 'filtering' a text file, exported from Excel as a
> 'Windows text file with <return>', containing <tabs> between numbers.

Sounds like a CSV file, having <HT> as field delimiter and <CR><LF> as
record delimiter. Right?

> So, besides converting all comma to points, I have to get rid af all
> <tabs> and after that, reduce all spaces between words to one space.
>
> So far its working : I have used the preg_split first with /\t/ then
> /\s+/ in two separate steps. No problem so far.

If this is a CSV file and the fields contain a number each, not words, then
I do not see how additional splitting at /\s+/ would help. The fields
should not contain white-space as they contain only one number each and are
delimited by white-space, in particular <HT> ("\t").

> If they arise, I'll come back again.
>
>> You might also want to exclude periods (`.') and other punctuation from
>> words,
>
> I can't. I need the numbers and they may be decimals with points.

Do you know <http://php.net/fgetcsv>?

>> You might find [5] useful, in particular [6], for the next time that you
>> post (translations are available there).
>>
>
> Thanks very much indeed for the most exhaustive answer ! I am happy
> I've found this place.

You are welcome. (But there should be no space before the `!' in English or
German.)


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: reduce all spaces to one [message #176913 is a reply to message #176910] Sun, 05 February 2012 04:02 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
John <john_takethisoff(at)agdp(dot)de> wrote in
news:jgkj4t$j9l$1(at)speranza(dot)aioe(dot)org:

> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>
>> I do not think you have fully understood what I have said (maybe you
>> want to try posting to *de*.comp.lang.php instead?). *All* presented
>> solutions so far, including yours and mine, are "'regex' solutions".
>> But the set of characters that are replaced differs between them.
>>
>
> Thanks for the suggestions and advice : however I hope my english is
> adequate enough to make myself understood in this NG :-))

Your English is more than adequate. [*] However, PointedHead's often is not. English is not his first
language; as far as I know, German is. And he doesn't understand English, or express himself
thereby, as well as he thinks he does. If you are a native speaker of German, you would assuredly
communicate more clearly with him, and he with you, in your native tongue.

[*] In fact, it's excellent. I'm a native speaker of American English, I've been following this thread
since the beginning, and I had no inkling before today that you might not be a native speaker also.
Re: reduce all spaces to one [message #176914 is a reply to message #176913] Sun, 05 February 2012 04:35 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Doug Miller wrote:

> John <john_takethisoff(at)agdp(dot)de> wrote:
>> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>> I do not think you have fully understood what I have said (maybe you
>>> want to try posting to *de*.comp.lang.php instead?). *All* presented
>>> solutions so far, including yours and mine, are "'regex' solutions".
>>> But the set of characters that are replaced differs between them.
>> Thanks for the suggestions and advice : however I hope my english is
>> adequate enough to make myself understood in this NG :-))
>
> Your English is more than adequate. [*] However, PointedHead's often is
> not. English is not his first language; as far as I know, German is. And
> he doesn't understand English, or express himself thereby, as well as he
> thinks he does. If you are a native speaker of German, you would assuredly
> communicate more clearly with him, and he with you, in your native tongue.
>
> [*] In fact, it's excellent. I'm a native speaker of American English,
> [I've been following this thread since the beginning, and I had no inkling
> before today that you might not be a native speaker also.

If you cannot find anything wrong with phrases like "the 'regex' solutions
fits perfectly", then you must be bli^Wborn Northern American. Such people
− unless they have studied English literature – are not really qualified to
make a proper assessment of what is or is not proper English. *Ain't* it
so, *bro*? You would be well-advised to learn your own language instead of
misleading people into believing that they are "excellent" at it.

Then again, you are only an address-munging troll who has not contributed a
single line of on-topic content to this newsgroup *at least* within the last
two months, so nobody sane here should really care what you think.

Speaking of which, the OP is an address munger too, so unfortunately he must
join you in my killfile.

<http://www.interhack.net/pubs/munging-harmful/>


F'up2 poster

PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom(at)94(dot)75(dot)214(dot)39>
[OT]: "native" English (was: reduce all spaces to one) [message #176915 is a reply to message #176913] Sun, 05 February 2012 10:03 Go to previous messageGo to next message
Gregor Kofler is currently offline  Gregor Kofler
Messages: 69
Registered: September 2010
Karma: 0
Member
Am 2012-02-05 05:02, Doug Miller meinte:
> John <john_takethisoff(at)agdp(dot)de> wrote in
> news:jgkj4t$j9l$1(at)speranza(dot)aioe(dot)org:
>
>> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>>
>>> I do not think you have fully understood what I have said (maybe you
>>> want to try posting to *de*.comp.lang.php instead?). *All* presented
>>> solutions so far, including yours and mine, are "'regex' solutions".
>>> But the set of characters that are replaced differs between them.
>>>
>>
>> Thanks for the suggestions and advice : however I hope my english is
>> adequate enough to make myself understood in this NG :-))
>
> Your English is more than adequate. [*] However, PointedHead's often is not. English is not his first
> language; as far as I know, German is. And he doesn't understand English, or express himself
> thereby, as well as he thinks he does. If you are a native speaker of German, you would assuredly
> communicate more clearly with him, and he with you, in your native tongue.
>
> [*] In fact, it's excellent. I'm a native speaker of American English, I've been following this thread
> since the beginning, and I had no inkling before today that you might not be a native speaker also.

I'm not a native speaker (and do have my fair share of grammar and
spelling mistakes in my postings, too), but the original posting

"what would be in PHP the equivalent of the VB .NET statement
Text = Regex.Replace(Text, "[ ]+", " ")
in order to reduce to one all the spaces between words (chr(32)) ???"

sounds a bit Yodaish to me - it's easy to understand but not what I'd
expect from a *native* speaker.

Gregor
Re: [OT]: "native" English [message #176916 is a reply to message #176915] Sun, 05 February 2012 10:11 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Gregor Kofler wrote:
> Am 2012-02-05 05:02, Doug Miller meinte:
>> John <john_takethisoff(at)agdp(dot)de> wrote in
>> news:jgkj4t$j9l$1(at)speranza(dot)aioe(dot)org:
>>
>>> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>>> I do not think you have fully understood what I have said (maybe you
>>>> want to try posting to *de*.comp.lang.php instead?). *All* presented
>>>> solutions so far, including yours and mine, are "'regex' solutions".
>>>> But the set of characters that are replaced differs between them.
>>>>
>>> Thanks for the suggestions and advice : however I hope my english is
>>> adequate enough to make myself understood in this NG :-))
>> Your English is more than adequate. [*] However, PointedHead's often is not. English is not his first
>> language; as far as I know, German is. And he doesn't understand English, or express himself
>> thereby, as well as he thinks he does. If you are a native speaker of German, you would assuredly
>> communicate more clearly with him, and he with you, in your native tongue.
>>
>> [*] In fact, it's excellent. I'm a native speaker of American English, I've been following this thread
>> since the beginning, and I had no inkling before today that you might not be a native speaker also.
>
> I'm not a native speaker (and do have my fair share of grammar and
> spelling mistakes in my postings, too), but the original posting
>
> "what would be in PHP the equivalent of the VB .NET statement
> Text = Regex.Replace(Text, "[ ]+", " ")
> in order to reduce to one all the spaces between words (chr(32)) ???"
>
> sounds a bit Yodaish to me - it's easy to understand but not what I'd
> expect from a *native* speaker.
>

just lacks punctuation.


e.i. "what would be (in PHP) the equivalent of the VB.NET statement:

Text = Regex.Replace(Text, "[ ]+", " ")

in order to reduce to one, *all* the spaces between words (chr(32)) ???"


But you are right: its slightly Germanic in the word order, ..one might
say more likely "reduce all the spaces between words, to one."

But that is something, up with which one can easily put...;-)
Re: [OT]: "native" English [message #176917 is a reply to message #176915] Sun, 05 February 2012 13:00 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Gregor Kofler wrote:

> I'm not a native speaker […], but the original posting
> […]
> sounds a bit Yodaish to me - […]
^^^^^^^
*g* I have to remember that one.


Regards,
--
(F'up2) PointedEars
Re: [OT]: "native" English [message #176918 is a reply to message #176917] Sun, 05 February 2012 13:53 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:
> Gregor Kofler wrote:
>
>> I'm not a native speaker […], but the original posting
>> […]
>> sounds a bit Yodaish to me - […]
> ^^^^^^^
> *g* I have to remember that one.
>
>
It's a classic - the Germanic construction is to put the verb at the
end, you may get the English words right, but the ordering of them is,
to a normal English speakers ear, a bit of a give-away.

The device is often used in drama to give an impression of foreign-ness.

As in

"The ordering of words, most important, is".

> Regards,
Re: reduce all spaces to one [message #176919 is a reply to message #176911] Sun, 05 February 2012 17:02 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 05.02.2012 02:56, schrieb Jerry Stuckle:

> The /\s+/ will also get rid of tabs, converting all white space to a
> single blank.
>
> Perhaps a better option would be to export the file as a .csv and use
> fgetcsv(). It will save you a lot of work.
>

I thought about that, but I am still left with the problem of some sort
of manual intervention : for example the literals are not embedded in
quotes. I'll have to differentiate between columns/rrow titles and
actual values.

Also the problem with the commas vs points is due to regional
configuration, (in the EU decimal values have mostly commas).
Re: reduce all spaces to one [message #176920 is a reply to message #176912] Sun, 05 February 2012 17:04 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 05.02.2012 03:15, schrieb Thomas 'PointedEars' Lahn:


> Sounds like a CSV file, having<HT> as field delimiter and<CR><LF> as
> record delimiter. Right?
>

not quite : the regional configuration uses commas instead of points
for decimal values
Re: reduce all spaces to one [message #176921 is a reply to message #176913] Sun, 05 February 2012 17:05 Go to previous messageGo to next message
John is currently offline  John
Messages: 18
Registered: September 2010
Karma: 0
Junior Member
Am 05.02.2012 05:02, schrieb Doug Miller:
> John<john_takethisoff(at)agdp(dot)de> wrote in

> Your English is more than adequate. [*]
> [*] In fact, it's excellent.

Thanks to my irish wife... I'm italian actually...:-)))
Re: reduce all spaces to one [message #176923 is a reply to message #176904] Sun, 05 February 2012 20:47 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Jerry Stuckle)

> On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
>>
>> Note that the newline, which is white-space too, is preserved here.
>>
>
> Newline is preserved in my version also, if you understood ANYTHING
> about how PHP's regex's work (but we already know you don't).

You want to read the manual and not start a flame war everytime you
answer to a person you don't like.

By default \s also matches LF and CR, because internally the C library
function isspace() function is used:

http://www.cplusplus.com/reference/clibrary/cctype/isspace/

> It also
> takes out tabs - which may be inserted automatically by some editors,
> for instance, and can be desirable.

Correct, but the OP didn't ask for that.

>> If you want to make the space character in the expression better visible,
>> you can use
>>
>> (1) echo preg_replace('/\ +/', ' ', "here are some \n spaces ");
>>
>
> The search pattern is invalid.

No. You can escape every char you want, even if it's not necessary.

>> or
>>
>> (2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces ");
>>
>
> Searches for the sequence '\ '

No. The double backslash is handled by PHP (see escaping in single-
quoted strings), after then it's just like (1).

BTW: If you want to match a backslash, you'd have to write '\\\\' in the
pattern.

>> or
>>
>> (3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces ");
>>
>
> Ugh!

Perfectly legal and sometimes the only way to define very special
characters.

>> or
>>
>> (4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces ");
>>
>
> Again, invalid escape sequence.

Again you're wrong, see (2).

> Showing your ignorance again. You do better when you keep your mouth shut.

It's _you_ who should keep the mouth shut in cases like this, especially
if obviously you didn't take the time to test the given examples, but
call them invalid instead. But since they just use different escaping
mechanisms in PHP and the PCRE engine, they're absolutely valid and
useful in different cases.

Micha

--
http://mfesser.de/blickwinkel
Re: reduce all spaces to one [message #176924 is a reply to message #176923] Sun, 05 February 2012 21:12 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/5/2012 3:47 PM, Michael Fesser wrote:
> .oO(Jerry Stuckle)
>
>> On 2/4/2012 9:41 AM, Thomas 'PointedEars' Lahn wrote:
>>>
>>> Note that the newline, which is white-space too, is preserved here.
>>>
>>
>> Newline is preserved in my version also, if you understood ANYTHING
>> about how PHP's regex's work (but we already know you don't).
>
> You want to read the manual and not start a flame war everytime you
> answer to a person you don't like.
>
> By default \s also matches LF and CR, because internally the C library
> function isspace() function is used:
>
> http://www.cplusplus.com/reference/clibrary/cctype/isspace/
>
>> It also
>> takes out tabs - which may be inserted automatically by some editors,
>> for instance, and can be desirable.
>
> Correct, but the OP didn't ask for that.
>
>>> If you want to make the space character in the expression better visible,
>>> you can use
>>>
>>> (1) echo preg_replace('/\ +/', ' ', "here are some \n spaces ");
>>>
>>
>> The search pattern is invalid.
>
> No. You can escape every char you want, even if it's not necessary.
>
>>> or
>>>
>>> (2) echo preg_replace('/\\ +/', ' ', "here are some \n spaces ");
>>>
>>
>> Searches for the sequence '\ '
>
> No. The double backslash is handled by PHP (see escaping in single-
> quoted strings), after then it's just like (1).
>
> BTW: If you want to match a backslash, you'd have to write '\\\\' in the
> pattern.
>
>>> or
>>>
>>> (3) echo preg_replace('/\x20+/', ' ', "here are some \n spaces ");
>>>
>>
>> Ugh!
>
> Perfectly legal and sometimes the only way to define very special
> characters.
>
>>> or
>>>
>>> (4) echo preg_replace('/\\x20+/', ' ', "here are some \n spaces ");
>>>
>>
>> Again, invalid escape sequence.
>
> Again you're wrong, see (2).
>
>> Showing your ignorance again. You do better when you keep your mouth shut.
>
> It's _you_ who should keep the mouth shut in cases like this, especially
> if obviously you didn't take the time to test the given examples, but
> call them invalid instead. But since they just use different escaping
> mechanisms in PHP and the PCRE engine, they're absolutely valid and
> useful in different cases.
>
> Micha
>

That's all we need - another troll in this newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: reduce all spaces to one [message #176925 is a reply to message #176924] Sun, 05 February 2012 21:23 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 05.02.2012 22:12, schrieb Jerry Stuckle:
> On 2/5/2012 3:47 PM, Michael Fesser wrote:
>> .oO(Jerry Stuckle)
>>

--cut
>>>
>>> Again, invalid escape sequence.
>>
>> Again you're wrong, see (2).
>>
>>> Showing your ignorance again. You do better when you keep your mouth shut.
>>
>> It's _you_ who should keep the mouth shut in cases like this, especially
>> if obviously you didn't take the time to test the given examples, but
>> call them invalid instead. But since they just use different escaping
>> mechanisms in PHP and the PCRE engine, they're absolutely valid and
>> useful in different cases.
>>
>> Micha
>>
>
> That's all we need - another troll in this newsgroup.
>

I can understand your grief - you want to be the only one. But calm down, you still are.

/Str.
Re: reduce all spaces to one [message #176927 is a reply to message #176925] Sun, 05 February 2012 21:37 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
M. Strobel wrote:
> Am 05.02.2012 22:12, schrieb Jerry Stuckle:

>> That's all we need - another troll in this newsgroup.
>>
>
> I can understand your grief - you want to be the only one. But calm down, you still are.
>
>

:-)
Re: reduce all spaces to one [message #176928 is a reply to message #176924] Sun, 05 February 2012 22:34 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Jerry Stuckle)

> That's all we need - another troll in this newsgroup.

I didn't attack you, I just corrected you. But it's as usual - you can't
admit you were wrong. Instead you're still insulting people without any
reason, as always. What about some on-topic comments about my posting?

Micha

--
http://mfesser.de/blickwinkel
Re: reduce all spaces to one [message #176929 is a reply to message #176914] Mon, 06 February 2012 01:31 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
On 04 Feb 2012, you wrote in comp.lang.php:

> Doug Miller wrote:
>
>> John <john_takethisoff(at)agdp(dot)de> wrote:
>>> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>>> I do not think you have fully understood what I have said (maybe
>>>> you want to try posting to *de*.comp.lang.php instead?). *All*
>>>> presented solutions so far, including yours and mine, are "'regex'
>>>> solutions". But the set of characters that are replaced differs
>>>> between them.
>>> Thanks for the suggestions and advice : however I hope my english is
>>> adequate enough to make myself understood in this NG :-))
>>
>> Your English is more than adequate. [*] However, PointedHead's often
>> is not. English is not his first language; as far as I know, German
>> is. And he doesn't understand English, or express himself thereby, as
>> well as he thinks he does. If you are a native speaker of German, you
>> would assuredly communicate more clearly with him, and he with you,
>> in your native tongue.
>>
>> [*] In fact, it's excellent. I'm a native speaker of American
>> English, [I've been following this thread since the beginning, and I
>> had no inkling before today that you might not be a native speaker
>> also.
>
> If you cannot find anything wrong with phrases like "the 'regex'
> solutions fits perfectly", then you must be bli^Wborn Northern
> American. Such people − unless they have studied English literature
> – are not really qualified to make a proper assessment of what is or
> is not proper English. *Ain't* it so, *bro*? You would be
> well-advised to learn your own language instead of misleading people
> into believing that they are "excellent" at it.
While his English is not perfect, it's better than that of a good many native speakers. And he seems to
understand it quite a bit better than you do.

My comment stands: you neither write nor understand English as well as you think you do.

Now go back to trolling the Javascript newsgroups.
Re: reduce all spaces to one [message #176931 is a reply to message #176929] Mon, 06 February 2012 08:31 Go to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 06.02.2012 02:31, schrieb Doug Miller:
> On 04 Feb 2012, you wrote in comp.lang.php:
>
>> Doug Miller wrote:
>>
>>> John <john_takethisoff(at)agdp(dot)de> wrote:
>>>> Am 05.02.2012 00:05, schrieb Thomas 'PointedEars' Lahn:
>>>> > I do not think you have fully understood what I have said (maybe
>>>> > you want to try posting to *de*.comp.lang.php instead?). *All*
>>>> > presented solutions so far, including yours and mine, are "'regex'
>>>> > solutions". But the set of characters that are replaced differs
>>>> > between them.
>>>> Thanks for the suggestions and advice : however I hope my english is
>>>> adequate enough to make myself understood in this NG :-))
>>>
>>> Your English is more than adequate. [*] However, PointedHead's often
>>> is not. English is not his first language; as far as I know, German
>>> is. And he doesn't understand English, or express himself thereby, as
>>> well as he thinks he does. If you are a native speaker of German, you
>>> would assuredly communicate more clearly with him, and he with you,
>>> in your native tongue.
>>>
>>> [*] In fact, it's excellent. I'm a native speaker of American
>>> English, [I've been following this thread since the beginning, and I
>>> had no inkling before today that you might not be a native speaker
>>> also.
>>
>> If you cannot find anything wrong with phrases like "the 'regex'
>> solutions fits perfectly", then you must be bli^Wborn Northern
>> American. Such people − unless they have studied English literature
>> – are not really qualified to make a proper assessment of what is or
>> is not proper English. *Ain't* it so, *bro*? You would be
>> well-advised to learn your own language instead of misleading people
>> into believing that they are "excellent" at it.
> While his English is not perfect, it's better than that of a good many native speakers. And he seems to
> understand it quite a bit better than you do.
>
> My comment stands: you neither write nor understand English as well as you think you do.
>
> Now go back to trolling the Javascript newsgroups.

Don't be so baaad. He will choke on "Javascript".

/Str.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Check email
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 16:48:21 GMT 2024

Total time taken to generate the page: 0.03543 seconds