From: RLMuller@... (Richard) Date: 2003-05-26T15:18:10+09:00 Subject: Modified "showRE" anomalies I modified "showRE" demonstrated in the online version of Programming Ruby. My purpose was to have what struck me as a more convenient way of analyzing the nuances of Ruby's implementation of Regular Expressions. My mod is: def applyRE(a,re) if a =~ re puts "Val '#{a}', Pat '#{re}' ==> #{$`}<<#{$&}>>#{$'}" else puts "Val '#{a}', Pat '#{re}' ==> no match" end end v1 = '12.34' p1 = '/^\d*\.?/' applyRE(v1, /^\d*\.?/) # Val '12.34', Pat '#' ==> <<12.>>34 applyRE(v1, p1) # Val '12.34', Pat '/^\d*\.?/' ==> no match The first invocation with a literal pattern argument applies the pattern correctly but doesn't display the pattern as a string, which I intended. The second invocation with a variable argument containing the pattern displays the pattern as intended but doesn't apply the pattern as intended. Is there a simple way to correct my error(s)? TIA, Richard