From: "Ara.T.Howard" Date: 2005-09-14T23:21:34+09:00 Subject: Re: Surprising Regexp Behavior On Wed, 14 Sep 2005, Robert Klemme wrote: > Ah! In that case I'd something like: > > html.sub!(/(

)(.*?)(<\/p>)(.*)/) { $1 << $2.strip << $3 } it never occured to me that regexes could be made to be context sensitive in that way - that usage of the block, i think, makes them recognize more that the regular languages doesn't it? something like string.sub(pat){ $1 =~ /foo/ ? 'bar' : 'baz' } though i suppose you can only look backward using this unless the pattern was made quite general to ensure capture forward.... -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================