Skip to content

Instantly share code, notes, and snippets.

@kronos
Created September 9, 2010 21:48
Show Gist options
  • Save kronos/572649 to your computer and use it in GitHub Desktop.
Save kronos/572649 to your computer and use it in GitHub Desktop.
kronos:rubinius kronos$ git diff
diff --git a/lib/strscan.rb b/lib/strscan.rb
index 1d70184..4e3d9f4 100644
--- a/lib/strscan.rb
+++ b/lib/strscan.rb
@@ -124,7 +124,7 @@ class StringScanner
end
def pre_match
- string[0...(pos - match.to_s.size)] if matched?
+ string[0...(@prev_pos + match.begin(0))] if matched?
end
def reset_state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment