Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore non-capturing groups to fix anchored regex issue #478

Merged
merged 1 commit into from Sep 16, 2022

Conversation

mkienow-r7
Copy link
Contributor

@mkienow-r7 mkienow-r7 commented Sep 13, 2022

Description

Restores non-capturing groups removed in #381 to fix issues where the anchors will only apply to the immediate value they are next to rather than the sequence of values in an OR match. The tests on the previous PR passed since the examples do not contain any leading or trailing text. Thanks to @dmoinescu-r7 for drawing attention to the issue.

Example

  • The current regex ^NETIASPOT Management Console|Konsola zarzdzania NETIASPOT$" matches the following strings:
    NETIASPOT Management Console
    NETIASPOT Management Consoletest
    NETIASPOT Management Console test
    Konsola zarzdzania NETIASPOT
    testKonsola zarzdzania NETIASPOT
    test Konsola zarzdzania NETIASPOT
    
  • The corrected regex ^(?:NETIASPOT Management Console|Konsola zarzdzania NETIASPOT)$ only matches the following strings:
    NETIASPOT Management Console
    Konsola zarzdzania NETIASPOT
    

Motivation and Context

Fix regex issue.

How Has This Been Tested?

  • bundle exec ./bin/recog_verify FILENAME
  • rake tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have updated the documentation accordingly (or changes are not required).
  • I have added tests to cover my changes (or new tests are not required).
  • All new and existing tests passed.

@mkienow-r7 mkienow-r7 merged commit 221b79e into rapid7:main Sep 16, 2022
@mkienow-r7 mkienow-r7 deleted the bug/fix-anchor-or-issue branch September 16, 2022 21:20
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.

None yet

2 participants