jamadden / mrab-regex-hg

Automatically exported from code.google.com/p/mrab-regex-hg
0 stars 2 forks source link

K | C are note recognized in fuzzy search when followed by any symbol #118

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you're not using the latest version, please try that.

What steps will reproduce the problem?
1.>>> import regex
2.>>> print regex.search('kx{e}', 'cx')
None

What is the expected output? What do you see instead?
print regex.search('kx{e}', 'cx')
<regex.Match object; span=(0, 2), match='ko'>

Which version of Python? 32-bit or 64-bit?
regex: 2014.08.28 (same bug was with 2014.08.15)
python: Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul  2 2014, 
15:12:11) [MSC v.1500 64 bit (AMD64)] on win32

Which operating system? Big-endian or little-endian?
Windows 8.1 x64

Please provide any additional information below.
k | c are not recognized in a fuzzy search (or sub) when there is ANY symbol 
following them. When they are alone everything works as expected

>>> print regex.search('k{e}', 'c')
<regex.Match object; span=(0, 1), match='c', fuzzy_counts=(1, 0, 0)>

Original issue reported on code.google.com by Victor.P...@gmail.com on 29 Aug 2014 at 1:23

GoogleCodeExporter commented 9 years ago
The '{e}' applies to only the preceding item, just like the quantifiers.

For example, in 'kx{2,}', the '{2,]' applies only to the 'x', and in 'kx+', the 
'+' applies only to the 'x'.

If you want it to apply to all of 'kx', you need to wrap that in a group, i.e. 
'(?:kx){e}'.

Original comment by re...@mrabarnett.plus.com on 29 Aug 2014 at 3:40