golang/go

regexp: doc: lead with the precise syntax rather than referring to Perl, Python, etc.

Closed

#39,405 创建于 2020年6月4日

在 GitHub 查看
 (11 评论) (0 反应) (0 负责人)Go (19,008 fork)batch import
DocumentationNeedsFixhelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

What did you do?

  • Regexp is not catching all of the whitespace values that is should
  • In particular \s is not matching hair spaces (whereas perl regex does)

Here's a go playground link

What did you expect to see?

It should match the white space.

What did you see instead?

It did not recognize the hair space as valid white space.

If this is indeed the intended behavior, the docs should be more clear that golang's regex does not conform with perl's and will not match all of the standard regex special characters.

If the docs already say this loudly and clearly and I just missed that section, apologies for being an idiot.

贡献者指南