You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: brand and competitor names that start or end with a non-ASCII letter or punctuation are never counted as mentions #871
JavaScript's \b only treats ASCII [A-Za-z0-9_] as word characters (even with the u flag). When a name starts or ends with anything else — an accented letter, a non-Latin script, or punctuation — there is no "word boundary" where one is expected, and the name never matches.
countBrandMentions('I like Émile Studio. Émile Studio is great.',{brandName: 'Émile Studio',domains: []});// 0countBrandMentions('I like Acme!. Acme! is great.',{brandName: 'Acme!',domains: []});// 0countBrandMentions('I like C++. C++ is great.',{brandName: 'C++',domains: []});// 0countBrandMentions('I like Acme. Acme is great.',{brandName: 'Acme',domains: []});// 2
For a brand like that, every answer reports zero mentions and no mention position, so visibility looks like zero even when the AI names the brand in every answer. The same applies to competitors.
Expected behavior
A name is matched as a whole word regardless of the script or characters it starts and ends with, and is still not matched inside a longer word (Acme must not match Acmegroup).
Suggested fix
Replace \b in both helpers with Unicode-aware lookarounds and add the u flag, for example:
Add cases to server/src/lib/response-parser.test.js: accented and non-Latin names, names ending in punctuation (Acme!, C++), a name inside a longer word (no match), and computeMentionPosition ordering with such a name.
Run yarn test from server/ before opening the PR — see CONTRIBUTING.md.
Activity
fix(visibility): count names that start or end outside ASCII letters (a…