Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-03-18
14:47 • Closed ticket [8663689908]: regexp \\w missing characters plus 6 other chang... artifact: 6e95fe7d69 user: jan.nijtmans
14:46
Fix [8663689908]. Final documentation fix, implementation was already fixed earlier. check-in: 137b855365 user: jan.nijtmans tags: core-8-6-branch
2016-07-22
21:18 • Open ticket [8663689908]: regexp \\w missing characters plus 6 other changes artifact: 18425a2c56 user: dgp
2016-04-08
12:33 • Ticket [8663689908]: 5 changes artifact: 10e29ceb9a user: dgp
12:29 • Closed ticket [8663689908]. artifact: 0f31e50e0d user: jan.nijtmans
12:26
Fix [8663689908d3304a74fee525cd04aa4162e86391|8663689908d3]: regexp \\w missing characters check-in: a3e6750fec user: jan.nijtmans tags: core-8-6-branch
12:23
Fix [8663689908d3304a74fee525cd04aa4162e86391|8663689908d3]: regexp \\w missing characters check-in: 4ca1a7770f user: jan.nijtmans tags: core-8-5-branch
12:10 • Ticket [8663689908] regexp \\w missing characters status still Open with 4 o... artifact: 74635fb1cb user: jan.nijtmans
12:09 • New ticket [8663689908]. artifact: dc39e41818 user: jan.nijtmans

regexp \\w missing characters

Closed / Fixed8663689908d3304a74fee525cd04aa4162e86391Created 11 years agoUpdated 6 years ago
Descriptionplain2016-04-08 12:09:48
% string is word \u203f
1
% regexp \\w \u203f
0

It appears that the character UNDERTIE (\u203f) is considered a word character by "string is word", but not in the regexp engine. In total, 9 characters are missing, all characters in the Unicode category Pc (Puntuation Connector)
Referenced by3
jan.nijtmans Ticket [8663689908]: 4 changes [History diff]2016-04-08 12:10:14
jan.nijtmansplain2016-04-08 12:29:58
Fixed in all active branches
dgpplain2016-04-08 12:33:32
Please notify Tom Lane (user 'tgl') about this change.
dgpplain2016-07-22 21:18:47
Tcl docs (re_syntax.n) say that the "CLASS-SHORTHAND ESCAPES"
are defined:

 \w        [[:alnum:]_] (note underscore)

By this description, \u203f ought to match
regexp {\w} only if it matches {[[:alnum:]]}.

% info patch
8.6.6
% regexp {\w} \u203f
1
% regexp {[[:alnum:]]} \u203f
0

Something in this collection of facts isn't right.
jan.nijtmanswiki2021-03-18 14:47:22

> Something in this collection of facts isn't right.

Indeed, in this case the documentation is not correct. In the pre-unicode world, "word" characters were [a-zA-Z0-9_]. This is indeed the alphanumeric characters and the underscore.

In the Unicode world, "word" characters are the alphanumeric characters and the "CONNECTOR_PUNCTUATION" characters (Pc). That's the underscore, but also 9 more:

UNDERTIE ‿ CHARACTER TIE ⁀ INVERTED UNDERTIE ⁔ PRESENTATION FORM FOR VERTICAL LOW LINE ︳ PRESENTATION FORM FOR VERTICAL WAVY LOW LINE ︴ DASHED LOW LINE ﹍ CENTRELINE LOW LINE ﹎ WAVY LOW LINE ﹏ FULLWIDTH LOW LINE _

So, the documentation should be adapted. The implementation is already doing this correctly. Done now in core-8-6-branch and up.

Log in (anonymous is fine) to add a comment.