Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > matching only white space

Reply
Thread Tools

matching only white space

 
 
Matt Garrish
Guest
Posts: n/a
 
      01-14-2004
My apologies for the duplicate posting. My news server crapped out while I
was trying to send, but seems to have sent the first copy anyway...

Matt


 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      01-14-2004
Robin <(E-Mail Removed)> wrote:

> I dunno, would this match only white space: / */ . ... ?



What happened when you tried it?


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      01-14-2004
Marc Bissonnette <(E-Mail Removed)> wrote:

> If (s)he finds it inconvenient to read the perldocs in the dos window,
> perldoc whatever >whatever.txt
> dumps the output of the 'perldoc whatever' into whatever.txt for printing
> / bathroom reading / etc.



Do the pod2* converters (eg: pod2html) work?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      01-14-2004
Robin <(E-Mail Removed)> wrote:

> PS. I don't like being killfiled and flamed,



Do you expect folks to remain silent when you take cuts in line?

That is a pretty unreasonable expectation...


In article <(E-Mail Removed)>, (E-Mail Removed)
(Larry Wall) wrote: ...

[snip] I view a programming language as a place to be
explored, like Disneyland. You don't need to have a lot of preparation
to explore a theme park. You do have to go along with the crowd
control measures, though. In a sense, each ride has its own
prerequisites--if you cut in line, you risk getting tossed out of the
park.

What we have here in this newsgroup is a failure in crowd control.
Reading the FAQ is like staying in line--it's something you should
learn in kindergarten. Usenet needs a better kindergarten.


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      01-14-2004
Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
> "Jürgen Exner" <(E-Mail Removed)> wrote in message
> news:JX0Nb.10544$(E-Mail Removed)...
> > Robin wrote:
> > > I dunno, would this match only white space: / */ . ... ?
> > > or would it match somethin else with the white space?

> >
> > Why do you think a plain blank character would match any arbitrary white
> > space?
> > If you want to match white space then say so
> > /\s*/
> >
> > For further details please Read The Fine Manual: perldoc perlre
> >

>
> Everyone seems to be missing a fundemental point about optional content:
>
> my $line = 'IHAVENOWHITESPACE';
>
> if ($line =~ /\s*/) {
> print "D'oh!";
> }


So? It still didn't match anything but spaces.

Anno
 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      01-14-2004

"Anno Siegel" <(E-Mail Removed)-berlin.de> wrote in message
news:bu37e5$3p2$(E-Mail Removed)-Berlin.DE...
> Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> >
> > Everyone seems to be missing a fundemental point about optional content:
> >
> > my $line = 'IHAVENOWHITESPACE';
> >
> > if ($line =~ /\s*/) {
> > print "D'oh!";
> > }

>
> So? It still didn't match anything but spaces.
>


The spaces between spaces, I suppose, but not what the OP wanted to know
(and not \s solutions that have been posted). Writing a regex with nothing
but optional content is just pointless in so many ways it boggles my poor
mind...

Matt


 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      01-14-2004
Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
> "Anno Siegel" <(E-Mail Removed)-berlin.de> wrote in message
> news:bu37e5$3p2$(E-Mail Removed)-Berlin.DE...
> > Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > >
> > > Everyone seems to be missing a fundemental point about optional content:
> > >
> > > my $line = 'IHAVENOWHITESPACE';
> > >
> > > if ($line =~ /\s*/) {
> > > print "D'oh!";
> > > }

> >
> > So? It still didn't match anything but spaces.
> >

>
> The spaces between spaces, I suppose, but not what the OP wanted to know
> (and not \s solutions that have been posted). Writing a regex with nothing
> but optional content is just pointless in so many ways it boggles my poor
> mind...


As a stand-alone regex it wouldn't do much, though with /g it may serve
a purpose. As part of a larger regex it is perfectly useful.

I'm not sure what the OPs original question was.

Anno
 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      01-14-2004

"Anno Siegel" <(E-Mail Removed)-berlin.de> wrote in message
news:bu3e60$9r6$(E-Mail Removed)-Berlin.DE...
> Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> >
> > The spaces between spaces, I suppose, but not what the OP wanted to know
> > (and not \s solutions that have been posted). Writing a regex with

nothing
> > but optional content is just pointless in so many ways it boggles my

poor
> > mind...

>
> As a stand-alone regex it wouldn't do much, though with /g it may serve
> a purpose. As part of a larger regex it is perfectly useful.
>


True enough, though I personally can't think of any reason why you would
want to match/count these "spaces" in a string (but I suppose everything has
its purpose). length() would be the function most people would be looking
for, or so I would assume, as a count based on an optional pattern like the
above will always return the actual length plus one (that pesky "space" at
the beginning of the string).

>
> I'm not sure what the OPs original question was.
>


My understanding, at any rate, was that he had stumbled upon the above
nuance of regexes. In the lingo of today's youth he wrote:

I dunno, would this match only white space: / */ . ... ?
or would it match somethin else with the white space?

I will be so bold as to suggest that his understanding of whitespace is not
on par with yours... : )

Matt


 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      01-14-2004
Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
> "Anno Siegel" <(E-Mail Removed)-berlin.de> wrote in message
> news:bu3e60$9r6$(E-Mail Removed)-Berlin.DE...
> > Matt Garrish <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > >
> > > The spaces between spaces, I suppose, but not what the OP wanted to know
> > > (and not \s solutions that have been posted). Writing a regex with

> nothing
> > > but optional content is just pointless in so many ways it boggles my

> poor
> > > mind...

> >
> > As a stand-alone regex it wouldn't do much, though with /g it may serve
> > a purpose. As part of a larger regex it is perfectly useful.
> >

>
> True enough, though I personally can't think of any reason why you would
> want to match/count these "spaces" in a string (but I suppose everything has
> its purpose). length() would be the function most people would be looking
> for, or so I would assume, as a count based on an optional pattern like the
> above will always return the actual length plus one (that pesky "space" at
> the beginning of the string).


The length? You mean it matches once for every character, and then one
more? / */ is greedy, it will still match consecutive blanks in one
go. I wouldn't know how to characterize what it counts in a few words,
but it's not simply related to string length.

Anno
 
Reply With Quote
 
Marc Bissonnette
Guest
Posts: n/a
 
      01-14-2004
Tad McClellan <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Marc Bissonnette <(E-Mail Removed)> wrote:
>
>> If (s)he finds it inconvenient to read the perldocs in the dos
>> window, perldoc whatever >whatever.txt
>> dumps the output of the 'perldoc whatever' into whatever.txt for
>> printing / bathroom reading / etc.

>
>
> Do the pod2* converters (eg: pod2html) work?


I suspect that they do, but when I try it:
############################################
pod2html -infile=c:/perl/lib/pod/perlretut.pod -outfile=perlretut.html -
podpath=c:/perl/lib/pod/ -podroot c:/perl/lib/pod/
############################################

I get "No perl script found in input"

Now that you've made me think of it and try it - I'd be curious if someone
could point me in the right direction as to why the above doesn't work...

--
Marc Bissonnette
CGI / Database / Web Management Tools: http://www.internalysis.com
Something To Sell? Looking To Buy? http://www.whitewaterclassifieds.ca
Looking for a new ISP? http://www.canadianisp.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matching horizontal white space Magnus.Moraberg@gmail.com Python 2 09-12-2008 08:01 PM
Any programs to trim white space/ remove all white space in HTML file? Ben C HTML 6 01-28-2007 11:41 PM
matching a pattern with a space or no space?? erik Perl Misc 10 11-11-2005 12:43 PM
Why Python style guide (PEP-8) says 4 space indents instead of 8 space??? 8 space indents ever ok?? Christian Seberino Python 21 10-27-2003 04:20 PM
Stack space, global space, heap space Shuo Xiang C Programming 10 07-11-2003 07:30 PM



Advertisments