puts 'b a b'.gsub(/\b(?<!\$)a\b/, "B")puts 'b $a b'.gsub(/\b(?<!\$)a\b/, "B")
Standard input is empty
b B b b $a b
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!