From: Robert Klemme Date: 2004-05-15T00:13:51+09:00 Subject: Re: Regexp Error? "Ara.T.Howard" schrieb im Newsbeitrag news:Pine.LNX.4.44.0405140634490.5586-100000@fattire.ngdc.noaa.gov... > ^ and $ are special and they consume no chars and so are not really 'matched' > in the same way... > > your regex says 'zero or more chars before the end of a string' so you get > > > ^ 1 2 3 - 4 5 6 $ > --------------- > ^ > > the first go then then scanning starts again - the problem is that it's then > looking for something potentially zero widthed followed by something zero > widthed - which is always going to match (again). i guess the difference for > the second match is that it does not advance the scanner ptr and can therefore > know it's done... it does seem odd, Definitely! What strikes me odd is, that the engine must know start and end of the match. So it could relaize that end is at the end. > but without that behaviour it would be > hard to match empty strings, line boundries, and other zero widthed things... You mean because then it would immediately stop without matching anything. Yeah, might be true. The sed and awk examples show that apparently there's disagreement on how this should be handled. I just wonder why I didn't step into this pitfall earlier. Apparently I never felt the need for .* in a replacement context before. :-) Thx all! Kind regards robert