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

incorrect position reported using negative lookbehinds #749

Open
1 task done
sunnyzanchi opened this issue Jan 4, 2024 · 0 comments
Open
1 task done

incorrect position reported using negative lookbehinds #749

sunnyzanchi opened this issue Jan 4, 2024 · 0 comments

Comments

@sunnyzanchi
Copy link

Check for existing issues

  • Completed

Environment

macOS
Homebrew
vale version 2.30.0

Describe the bug / provide steps to reproduce it

hi! i think i've found a bug. when using a negative lookbehind in a substitution rule, the position is reported incorrectly if there are two occurrences on the same line. this is the rule i'm using

swap:
  '(?<!IP )address': discuss

and the file i'm using

# test

this is an IP address: 192.168.0.1. we should address this

expected:

  • error should be found at 3:47

actual:

  • error is reported at 3:15

this isn't an issue when the two occurrences of "address" are on different lines. this file

# test

this is an IP address: 192.168.0.1.
we should address this

correctly reports the error at 4:11

reproduction

repo: https://github.com/sunnyzanchi/vale-negative-lookbehind-bug

clone the repo and run cat *.md && vale *.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant