Skip to content

Commit

Permalink
[Refactor] Use iterative approach to evaluate Regex.simpleMatch (open…
Browse files Browse the repository at this point in the history
…search-project#11060)

* Remove adjacent duplicates to optimize regex before processing

Signed-off-by: Craig Perkins <[email protected]>

* Add tests

Signed-off-by: Craig Perkins <[email protected]>

* Rename to removeAdjacentDuplicates

Signed-off-by: Craig Perkins <[email protected]>

* Add additional test case

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Throw IllegalArgumentException if input is invalid

Signed-off-by: Craig Perkins <[email protected]>

* Add a space

Signed-off-by: Craig Perkins <[email protected]>

* Change error message

Signed-off-by: Craig Perkins <[email protected]>

* Use iterative solution with 2 pointers

Signed-off-by: Craig Perkins <[email protected]>

* Remove unused method

Signed-off-by: Craig Perkins <[email protected]>

* add tests and changelog

Signed-off-by: Stephen Crawford <[email protected]>

* remove bad push

Signed-off-by: Stephen Crawford <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Stephen Crawford <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Stephen Crawford <[email protected]>

* spotless

Signed-off-by: Stephen Crawford <[email protected]>

* Update comment

Signed-off-by: Craig Perkins <[email protected]>

* re-run CI

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Stephen Crawford <[email protected]>
Co-authored-by: Stephen Crawford <[email protected]>
Co-authored-by: Stephen Crawford <[email protected]>
(cherry picked from commit 61a598b)
  • Loading branch information
cwperks committed Dec 1, 2023
1 parent 0a7ca6c commit 01df38a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
### Security

[Unreleased]: https://github.com/opensearch-project/OpenSearch/compare/1.3.12...HEAD
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void testDoubleWildcardMatch() {
assertFalse(Regex.simpleMatch("fff**ddd", "fffabcdd"));
assertTrue(Regex.simpleMatch("fff*******ddd", "fffabcddd"));
assertTrue(Regex.simpleMatch("fff*******ddd", "FffAbcdDd", true));
assertFalse(Regex.simpleMatch("fff*******ddd", "FffAbcdDd", false));
assertFalse(Regex.simpleMatch("fff******ddd", "fffabcdd"));
assertFalse(Regex.simpleMatch("fff*******ddd", "FffAbcdDd", false));
assertTrue(Regex.simpleMatch("abCDefGH******ddd", "abCDefGHddd", false));
Expand Down

0 comments on commit 01df38a

Please sign in to comment.