<p>(<a href="https://play.golang.org/p/6uXcuL3iyF" rel="nofollow">playground link</a>, <a href="https://imgur.com/5YAel8Q" rel="nofollow">screenshot of the result in case it was fixed later</a>)</p>
<p>I tried to match the string <code>"asdf \t\nkkkk"</code> against regexp</p>
<pre><code>`\s*`
</code></pre>
<p>and it doesn't match. But</p>
<pre><code>`\s+`
</code></pre>
<p>works. I think they both should work? Am I holding it wrong?</p>
<hr/>**评论:**<br/><br/>snakeshands: <pre><p>A match is being reported in both cases; the first match of zero-or-more-whitespace-characters occurs at index 0, and is 0 characters long.</p>
<p>When there is no match, FindStringIndex() returns nil, not [0, 0].</p></pre>fishywang: <pre><p>You are right. Thanks.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传