From: "Bartosz DziewoƄski" Date: 2011-08-13T06:34:45+09:00 Subject: Re: Odd regexp behavior The first one, (\s|$), is simply a group, matching either whitespace, or a position - end-of-line. The other one is a lookahead group which matches a *position* - a *zero-width string*, if you like - if, at this place in string, either following characters are whitespace, or this position is also the end of line (the following characters themselves are *not* matched). You need to understand that once a character is matched, it's *gone* - this gsub/match/scan/whatever will not match it again in this run. Have you tried inputting the data, and both regexes, in regexpal and comparing the results? I think it really clearly shows graphically what I mean. -- Matma Rex