From: Robert Dober Date: 2007-05-04T19:15:44+09:00 Subject: RCR? Hi list I'd like to have your feedback on yet another RCR idea I had. Currently I am writing lots of code like this: "some string".gsub(/s/,"") # I am using more complex rgxs therefore String#delete is not # an option. I would like to write "some string".gsub(/s/) instead. There are two roads to walk: (a) Allow String#delete to have a Regex (b) Give String#gsub, String#sub, String#gsub! and String#sub! the empty string as default for parameter replacement. (a) "abcdefgh".delete(/[aeiou]/) For: It is concise syntax, and does very nicely what the method name says, however... Against: does it delete the first match or all matches? I'd say all to be consistent with the classical behavior of #delete, to replace only the first match would be a very bad inconsistency. Therefore we would have the semantics of gsub(...,"") and sub(...,"") would not be available. I do not like it. (b) "abcdef".gsub(/[aeiou]/) and "ijklmnop".sub(/[aeiou]/) and the ! variants of course. For: I like it :) I feel that it is very Rubyish Should be trivial to implement. Againts: Well it is a change request for very little functionality, but if enough people like it and if Matz likes it ;) Ty for tour thoughts. Cheers Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw