Skip to content

Instantly share code, notes, and snippets.

@kronos
Created October 4, 2010 21:51
Show Gist options
  • Save kronos/610511 to your computer and use it in GitHub Desktop.
Save kronos/610511 to your computer and use it in GitHub Desktop.
diff --git a/kernel/common/string.rb b/kernel/common/string.rb
index 220bab2..4e175a7 100644
--- a/kernel/common/string.rb
+++ b/kernel/common/string.rb
@@ -1063,9 +1063,9 @@ class String
return find_string(needle, offset)
when Regexp
- if match = needle.match_from(self[offset..-1], 0)
+ if match = needle.match_from(self, offset)
Regexp.last_match = match
- return (offset + match.begin(0))
+ return match.begin(0)
else
Regexp.last_match = nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment