This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 9 · Feb 24 – Mar 2, 2025

regexp/syntax: recognize Unicode category aliases

Worth knowingstdlib

What changed
The regexp package now recognises Unicode category aliases, the pseudo‑categories Any, Assigned, and ASCII, and accepts case‑insensitive names such as \p{ascii}.
Production impact
The source does not say.
Try it
Run go test -run TestUnicodeAliases in the regexp package.
Source
github.com/golang/go/issues/70781

Understand it, then run it

The regexp package in Go can match Unicode characters using the \p{…} syntax. Before this change, it only understood the short two‑letter codes like \p{L} for letters. It did not recognize longer names such as \p{Letter} or the special groups \p{Any}, \p{Assigned}, and \p{ASCII}. The new change adds support for those longer names and for the pseudo‑categories. It also makes the names case‑insensitive, so \p{ascii} works the same as \p{ASCII}. With this update, patterns that use the full Unicode names will work correctly, making the package more aligned with the Unicode standard and easier to use in real‑world text processing.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed