Skip to content

Commit

Permalink
GEODE-8587: Redis glob pattern does not match carriage return, line f…
Browse files Browse the repository at this point in the history
…eed, and tab (apache#5608)
  • Loading branch information
sabbey37 authored Oct 8, 2020
1 parent faef811 commit c9ba7fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ public void givenBinaryValue_withExactMatch_preservesBinaryData() {
assertThat(jedis.keys(stringKey)).containsExactlyInAnyOrder(stringKey);
}

@Test
public void givenSplat_withCarriageReturnLineFeedAndTab_returnsExpectedMatches() {
jedis.set(" foo bar ", "123");
jedis.set(" foo\r\nbar\r\n ", "456");
jedis.set(" \r\n\t\\x07\\x13 ", "789");

assertThat(jedis.keys("*")).containsExactlyInAnyOrder(" \r\n\t\\x07\\x13 ", " foo\r\nbar\r\n ",
" foo bar ");
}

@Test
public void givenMalformedGlobPattern_returnsEmptySet() {
assertThat(jedis.keys("[][]")).isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private Pattern createPattern(String glob) {
regex.append(']');
}

return Pattern.compile(regex.toString());
return Pattern.compile(regex.toString(), Pattern.DOTALL | Pattern.MULTILINE);
}

@Override
Expand Down

0 comments on commit c9ba7fa

Please sign in to comment.