Title ending with 'non-word character' do not match

Created on 5 September 2016, about 8 years ago
Updated 27 July 2024, about 1 month ago

Problem/Motivation

Node titles ending in 'non word characters' are not matched.

The following title for example alternate, alternative (as adjectives) will not match.

The reason for this is the use of /b (word boundaries) in the regular expression.

\b is a zero-length match which can occur between two characters in the string, where one is a word character and the other is not a word character. In PHP RegEx, a right parenthesis is not a word character, and neither is the end of the sting, so now we have a non-word character followed by a second non-word character and no match. Taken from this StackOverflow answer.

Proposed resolution

Replace the word boundaries with a non-capturing group that include word boundary or end of line.

Remaining tasks

None.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

🇦🇺Australia ajf__

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024