Skip to content

Conversation

@milkshakeuk
Copy link
Member

  • Add/Port more tests from hapi
  • clean up/improve MessageNavigator, SegmentFinder, Terser, various FilterIterator predicates

Looks like its always been a bug in nHapi due to the miss understanding of how regex in java vs C#, see below for a brief description of the difference.

The following in java...

Pattern.matches(pattern, candidate);

does not behave the same as the following in C#:

Regex.IsMatch(candidate, pattern);

in java the regular expression pattern must evaluate to a match on the entire candidate where as in C# the regular expression pattern must evaluate to a match within the candidate.

Pattern.matches("DIET", "TIMING_DIET"); // evaluates to false, because the pattern 'DIET' does not match 'TIMING_DIET'
Regex.IsMatch("TIMING_DIET", "DIET"); // evaluates to true, because the pattern 'DIET' has a match within 'TIMING_DIET'

This is what causes the bug described in #319

@github-actions
Copy link

github-actions bot commented Aug 30, 2022

Unit Test Results

       5 files         5 suites   19s ⏱️
1 150 tests 1 062 ✔️   88 💤 0
2 134 runs  2 030 ✔️ 104 💤 0

Results for commit d9242ab.

♻️ This comment has been updated with latest results.

@milkshakeuk
Copy link
Member Author

@AMCN41R if you get chance could you have a quick look at this?

* Add/Port more tests from hapi
* clean up/improve MessageNavigator, SegmentFinder, Terser, various FilterIterator predicates
@milkshakeuk milkshakeuk merged commit 3e3b767 into master Sep 1, 2022
@milkshakeuk milkshakeuk deleted the TerserRegexFix branch September 1, 2022 14:24
@milkshakeuk milkshakeuk linked an issue Sep 1, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot get ODS segment using terser, when I write a full path

3 participants