+ Regexp.new(new, self.options)
+ end
+
+ # We may want to remove head and tail anchors
+ def remove_head_tail
+ new = self.source.sub(/^\^/,'').sub(/\$$/,'')
+ Regexp.new(new, self.options)
+ end
+
+ # The MessageMapper cleanup method: does both remove_capture
+ # and remove_head_tail
+ def mm_cleanup
+ new = self.source.gsub(/(^|[^\\])((?:\\\\)*)\(([^?])/) {
+ "%s%s(?:%s" % [$1, $2, $3]
+ }.sub(/^\^/,'').sub(/\$$/,'')
+ Regexp.new(new, self.options)