[docs] Regex documentation bug

Georg Brandl georg at python.org
Fri May 20 10:02:50 EDT 2016


Hi Neta,

the indices returned from regex matches follow the same convention as slice
indices, in that the end index is exclusive: a slice from index 0 to index 11
has 11 items.

cheers,
Georg

On 05/19/2016 10:35 AM, Neta Oren wrote:
> Hi,
> I was reading your documentation page about regex, and noticed you had a mistake.
> The specific page is 'Regular Expression HOWTO -- Python 2.7.11 documentation'.
> It is located in the address: 
> https://docs.python.org/2/howto/regex.html
> The mistake is at the 'Performing Matches' section. 
> The mistake is:
> You wrote that the start() and end() methods will retnot end the starting and
> ending indices of the match. However in the example you provided the end index
> is in fact the length of the match, and not the ending index (that would be
> length - 1). 
> If the index starts at 0 and ends at 11 then that means there are 12 characters,
> however in your examples it was not as such.
> This can create array out of bounds exceptions and other exceptions as well.
> This error is repeated in this section several times.
> For your attention,
> Neta
> 
> 
> _______________________________________________
> docs mailing list
> docs at python.org
> https://mail.python.org/mailman/listinfo/docs
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/docs/attachments/20160520/fec5f785/attachment.sig>


More information about the docs mailing list