Page MenuHomePhabricator

Replace all (or at least most) uses of \b with (?:^|$|\s) or variants
Closed, ResolvedPublic

Description

We use \b often to match (?:^|$|\s), but it does in fact match "A word boundary matches the position where a word character is not followed or preceeded by another word-character.", where \w is equivalent to [A-Za-z0-9_] [1].

Example:
/\bfoo\b/.test('aaa:foo:bbb');
true

We should go through and fix all improper uses of \b.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#special-word-boundary


Version: unspecified
Severity: normal

Details

Reference
bz53727

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:47 AM
bzimport set Reference to bz53727.

Change 82562 had a related patch set uploaded by GWicke:
Bug 53727: Don't use \b to match (^|$|\s)

https://gerrit.wikimedia.org/r/82562

Change 82562 merged by jenkins-bot:
Bug 53727: Don't use \b to match (^|$|\s)

https://gerrit.wikimedia.org/r/82562