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

Exact terms not always detected #28

Closed
kimburgess opened this issue Nov 26, 2020 · 1 comment
Closed

Exact terms not always detected #28

kimburgess opened this issue Nov 26, 2020 · 1 comment
Labels

Comments

@kimburgess
Copy link

Thank you for putting this rule together.

I've been using it and have run into a number of cases where exact terms are not always matched. Unfortunately I have not had time to put together a PR, but have traced it to being due to the RegExp that is built here:

/**
* Match exact word in the middle of the text
* @param {string} pattern
*/
function getExactMatchRegExp(pattern) {
return new RegExp(
// 1. Beginning of the string, or any character that isn't "-" or alphanumeric
// 2. Exact match of the pattern
// 3. Space, ". ", "." at the end of the string, end of the string
`(?<=^|[^-\\w])\\b${pattern}\\b(?= |\\. |\\.$|$)`,
'ig'
);
}

Loading this into regex101, it's possible to see some of these cases failing: https://regex101.com/r/vOBa0O/1.

As a temporary workaround, the alternate ['regexp', 'replacement'] configuration syntax does not appear to be impacted.

mghill pushed a commit to PlaceOS/docs that referenced this issue Dec 10, 2020
Workaruond for sapegin/textlint-rule-terminology#28. Likely a better
configuration approach regardless of this issue as it should capture
more variants of core product terms.
@sapegin
Copy link
Owner

sapegin commented Jun 22, 2022

🎉 This issue has been resolved in version 3.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants