diff --git a/src/bytes_regex.cr b/src/bytes_regex.cr index 6f6c8d9..1345ad3 100644 --- a/src/bytes_regex.cr +++ b/src/bytes_regex.cr @@ -3,7 +3,7 @@ module BytesRegex class Regex def initialize(pattern : String, multiline = false, dotall = false, ignorecase = false, anchored = false) - flags = LibPCRE2::UTF | LibPCRE2::DUPNAMES | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK + flags = LibPCRE2::UTF | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK flags |= LibPCRE2::MULTILINE if multiline flags |= LibPCRE2::DOTALL if dotall flags |= LibPCRE2::CASELESS if ignorecase @@ -40,9 +40,7 @@ module BytesRegex LibPCRE2::NO_UTF_CHECK, @match_data, nil) - if rc < 0 - # No match, do nothing - else + if rc > 0 ovector = LibPCRE2.get_ovector_pointer(@match_data) (0...rc).each do |i| m_start = ovector[2 * i]