in reply to Setting Input record separator to chunk on paragraphs

He is assuming that all paragraphs end that way. For example, these two paragraphs would be counted as one:

    One day I found myself at the river, again thinking
about what happened that day. The water was cold,
didn't really help me relax. What a predicament!
    How could someone be so cold? Did I say
the wrong thing? And where was Charlie Sheen? I mean,
this was all his fault.

As you can see, there are clearly two paragraphs, but the last sentance of the first one breaks our "paragraph mode." So yes, you are correct, this doesn't catch every paragraph. We would need to specify that question marks and exclamation points would also constitute the end of a paragraph.

I tried to set $/ to a character class, but I don't think it is possible. The Camel Book says that it can be set to a multi-character delimiter, but nothing about a class of characters.

I assume that the author was using 'auto-wrap' and never actually typing a newline until the end of a paragraph.

hope this helps,
jeff

  • Comment on (jeffa) Re: Setting Input record separator to chunk on paragraphs

Replies are listed 'Best First'.
RE: Re: Setting Input record separator to chunk on paragraphs
by Anonymous Monk on Aug 20, 2000 at 14:56 UTC
    It says at http://etext.lib.virginia.edu/helpsheets/regex.html that ". Matches any one character " So therefore "." would mean to split anywhere that a character is followed by a line return.