<h2>问题形成</h2>
<h3>背景</h3>
<p>当我在<a href="http://docs.python.org/2/howto/regex.html#grouping" rel="nofollow">python2.7 redoc</a>阅读教程时,它介绍了组的行为:</p>
<blockquote>
<p>The groups() method returns a tuple containing the strings for all the subgroups, from 1 up to however many there are.</p>
</blockquote>
<h3>问题</h3>
<p>我很清楚这是如何单独运作的。但我能理解下面的例子:</p>
<pre><code>>>> m = re.match("([abc])+","abc")
>>> m.groups()
('c',)
</code></pre>
<p>我的意思是,<code>+</code>不仅仅意味着一个或多个。如果是这样的话,正则表达式<code>([abc])+</code>=<code>([abc])([abc])+</code>(不是形式的BNF)不应该吗。因此,结果应该是:</p>
<pre><code>('a','b','c')
</code></pre>
<p>请解释一下背后的机制,谢谢。你知道吗</p>
<h2>附言</h2>
<p>我想学习regex语言的解释器,我应该怎么开始呢?书籍或正则表达式版本,谢谢!你知道吗</p>