From: James Edward Gray II Date: 2005-04-06T23:54:37+09:00 Subject: Re: Regular expression mismatch ? 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