[ruby-core:78249] [Ruby trunk Feature#12964] Add sub? and gsub? method to string class.
From:
herwin@...
Date:
2016-11-22 10:13:14 UTC
List:
ruby-core #78249
Issue #12964 has been updated by Herwin Quarantainenet. I don't really see how this would be any different from `match?` Beside that, the semantics are a bit ambiguous. `"foo".sub(/bar/, 'x')` does work, it just doesn't replace anything because there is no match for the regex. So would `sub?` mean that we can replace it at least once, and `gsub?` that we can replace it at least twice? ---------------------------------------- Feature #12964: Add sub? and gsub? method to string class. https://bugs.ruby-lang.org/issues/12964#change-61614 * Author: Lachlan Wilger * Status: Feedback * Priority: Normal * Assignee: ---------------------------------------- The sub? and gsub? method would allow you to check if you can sub or gsub the string. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>