firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.2k stars 198 forks source link

Incorrect hint for Golang `\w` #2271

Closed wxiaoguang closed 1 month ago

wxiaoguang commented 2 months ago

Bug Description

regexp101 says: Golang \w match any word character in any script (equivalent to [\p{L}\p{N}_])

But Golang document says: \w : word characters (== [0-9A-Za-z_]) https://pkg.go.dev/regexp/syntax

Reproduction steps

image

    r := regexp.MustCompile(`\p{L}`)
    println(r.MatchString("α")) // true
    r = regexp.MustCompile(`\w`)
    println(r.MatchString("α")) // false

So the explanation equivalent to [\p{L}\p{N}_] is not right.

firasdib commented 1 month ago

Thanks, will be fixed in the next release