From: ts Date: 2005-01-27T19:20:32+09:00 Subject: Re: RegEx help (small) >>>>> "B" == Bil Kleb writes: B> gsub( /(?!\w)'(.*?)'/, '`\1\'' ) (?!) is a zero-width negative look-ahead B> assert_equal( "isn't fool'd", "isn't fool'd".to_tex ) When the regexp engine is at this position (just before ') "isn't fool'd" ^ | * it look if it don't have a word character (\w) : this is true because the first next character is ' * then it look if it has ' : it's true and it match Guy Decoux