On Fri, Mar 08, 2002 at 03:16:10PM +0100, Marcelo E. Magallon wrote: > > A question of my own: why doesn't > > s/\B.\B/$&$&/g > > work as I expect, namely abcd -> abbccd. I really can't figure it out > by reading the docs.
Because after matching the b and the non-boundaries around it, the non-boundary between b and c already matched. So the next match for non-boundary will match between c and d, and since there is no \B after d, you'll get abbcd. You can try to rewrite the regexp as s/_(.)_/$+$+/g; and match a_b_c_d Here, it should be obvious that after matching _b_, your next chance with _ is between c and d, not between b and c. Yours, -- ------------------------------------------------------------------------ Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/ ... all of these signs saying sorry but we're closed ... ------------------------------------------------------------------------