James Gray
4/6/2005 2:55:00 PM
On Apr 6, 2005, at 9:44 AM, Han Holl wrote:
> Hello,
>
> Why does the following:
>
> s = "aaa aaa\n\n\nbbb bbb"
> puts(s =~ /^\s+$/)
>
> produce: 8 (instead of nil) ?
^ means the beginning a line (right after \n)
$ means the end a line (right before \n)
\s+ manes one or more whitespace characters (the \n in the middle)
Does that clarify the match?
> (If I put in only 2 newlines, it's fine).
You can't satisfy all three conditions with only two \n characters.
Hope that helps.
James Edward Gray II