diff --git a/docs/text.md b/docs/text.md index c8a105d..3e6ed0d 100644 --- a/docs/text.md +++ b/docs/text.md @@ -337,6 +337,7 @@ mostly ignore spaces, underscores, and dashes. - `start` - the very start of the text - `uri` - a URI - `url` - a URL (URI that specifically starts with `http://`, `https://`, `ws://`, `wss://`, or `ftp://`) +- `word` - A unicode identifier (same as `id`) For non-alphabetic characters, any single character is treated as matching exactly that character. For example, `{1{}` matches exactly one `{` diff --git a/stdlib/patterns.c b/stdlib/patterns.c index bee8476..6a9b1a5 100644 --- a/stdlib/patterns.c +++ b/stdlib/patterns.c @@ -654,6 +654,11 @@ static pat_t parse_next_pat(TextIter_t *state, int64_t *index) return PAT(PAT_FUNCTION, .fn=match_url); } break; + case 'w': + if (strcasecmp(prop_name, "word") == 0) { + return PAT(PAT_FUNCTION, .fn=match_id); + } + break; default: break; }