Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4711 > unrolled thread
| Started by | John <john_takethisoff@agdp.de> |
|---|---|
| First post | 2012-02-03 20:03 +0100 |
| Last post | 2012-02-03 21:30 +0100 |
| Articles | 13 on this page of 33 — 9 participants |
Back to article view | Back to comp.lang.php
reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-03 20:03 +0100
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-03 14:36 -0500
Re: reduce all spaces to one crankypuss <no@email.thanks> - 2012-02-03 13:05 -0700
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-03 15:17 -0500
Re: reduce all spaces to one "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-03 21:19 +0100
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-03 21:59 +0100
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-04 15:41 +0100
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-04 09:57 -0500
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-04 16:05 +0100
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-04 16:21 +0100
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-04 16:00 -0500
Re: reduce all spaces to one Michael Fesser <netizen@gmx.de> - 2012-02-05 21:47 +0100
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-05 16:12 -0500
Re: reduce all spaces to one "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-05 22:23 +0100
Re: reduce all spaces to one The Natural Philosopher <tnp@invalid.invalid> - 2012-02-05 21:37 +0000
Re: reduce all spaces to one Michael Fesser <netizen@gmx.de> - 2012-02-05 23:34 +0100
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-04 22:26 +0100
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-05 00:05 +0100
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-05 01:39 +0100
Re: reduce all spaces to one Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-04 20:56 -0500
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-05 18:02 +0100
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-05 03:15 +0100
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-05 18:04 +0100
Re: reduce all spaces to one Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-02-05 04:02 +0000
Re: reduce all spaces to one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-05 05:35 +0100
Re: reduce all spaces to one Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-02-06 01:31 +0000
Re: reduce all spaces to one "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-06 09:31 +0100
[OT]: "native" English (was: reduce all spaces to one) Gregor Kofler <usenet@gregorkofler.com> - 2012-02-05 11:03 +0100
Re: [OT]: "native" English The Natural Philosopher <tnp@invalid.invalid> - 2012-02-05 10:11 +0000
Re: [OT]: "native" English Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-05 14:00 +0100
Re: [OT]: "native" English The Natural Philosopher <tnp@invalid.invalid> - 2012-02-05 13:53 +0000
Re: reduce all spaces to one John <john_takethisoff@agdp.de> - 2012-02-05 18:05 +0100
Re: reduce all spaces to one "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-03 21:30 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | John <john_takethisoff@agdp.de> |
|---|---|
| Date | 2012-02-05 18:02 +0100 |
| Message-ID | <jgmcn0$7lh$1@speranza.aioe.org> |
| In reply to | #4726 |
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).
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-05 03:15 +0100 |
| Message-ID | <2279559.TulgWSeKXN@PointedEars.de> |
| In reply to | #4725 |
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
[toc] | [prev] | [next] | [standalone]
| From | John <john_takethisoff@agdp.de> |
|---|---|
| Date | 2012-02-05 18:04 +0100 |
| Message-ID | <jgmcqk$7lh$2@speranza.aioe.org> |
| In reply to | #4727 |
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
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2012-02-05 04:02 +0000 |
| Message-ID | <Xns9FEFEA60898ADdougmilmaccom@88.198.244.100> |
| In reply to | #4725 |
John <john_takethisoff@agdp.de> wrote in news:jgkj4t$j9l$1@speranza.aioe.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.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-05 05:35 +0100 |
| Message-ID | <10547866.lkV0LKguhZ@PointedEars.de> |
| In reply to | #4728 |
Doug Miller wrote: > John <john_takethisoff@agdp.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@94.75.214.39>
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2012-02-06 01:31 +0000 |
| Message-ID | <Xns9FF0D0C8CA2A2dougmilmaccom@88.198.244.100> |
| In reply to | #4729 |
On 04 Feb 2012, you wrote in comp.lang.php: > Doug Miller wrote: > >> John <john_takethisoff@agdp.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.
[toc] | [prev] | [next] | [standalone]
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Date | 2012-02-06 09:31 +0100 |
| Message-ID | <9p9hfdFes7U1@mid.uni-berlin.de> |
| In reply to | #4744 |
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@agdp.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.
[toc] | [prev] | [next] | [standalone]
| From | Gregor Kofler <usenet@gregorkofler.com> |
|---|---|
| Date | 2012-02-05 11:03 +0100 |
| Subject | [OT]: "native" English (was: reduce all spaces to one) |
| Message-ID | <jglk5r$fld$1@dont-email.me> |
| In reply to | #4728 |
Am 2012-02-05 05:02, Doug Miller meinte: > John <john_takethisoff@agdp.de> wrote in > news:jgkj4t$j9l$1@speranza.aioe.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
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-02-05 10:11 +0000 |
| Subject | Re: [OT]: "native" English |
| Message-ID | <jglkk4$3us$1@news.albasani.net> |
| In reply to | #4730 |
Gregor Kofler wrote: > Am 2012-02-05 05:02, Doug Miller meinte: >> John <john_takethisoff@agdp.de> wrote in >> news:jgkj4t$j9l$1@speranza.aioe.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...;-)
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-05 14:00 +0100 |
| Subject | Re: [OT]: "native" English |
| Message-ID | <1936066.aqSPkdTlGX@PointedEars.de> |
| In reply to | #4730 |
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
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-02-05 13:53 +0000 |
| Subject | Re: [OT]: "native" English |
| Message-ID | <jgm1l5$879$1@news.albasani.net> |
| In reply to | #4732 |
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,
[toc] | [prev] | [next] | [standalone]
| From | John <john_takethisoff@agdp.de> |
|---|---|
| Date | 2012-02-05 18:05 +0100 |
| Message-ID | <jgmctg$7lh$3@speranza.aioe.org> |
| In reply to | #4728 |
Am 05.02.2012 05:02, schrieb Doug Miller: > John<john_takethisoff@agdp.de> wrote in > Your English is more than adequate. [*] > [*] In fact, it's excellent. Thanks to my irish wife... I'm italian actually...:-)))
[toc] | [prev] | [next] | [standalone]
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Date | 2012-02-03 21:30 +0100 |
| Message-ID | <9p2ufnFaudU1@mid.uni-berlin.de> |
| In reply to | #4711 |
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.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.php
csiph-web