/usr/share/pyshared/hachoir_regex-1.0.5-py2.6.egg-info is in python-hachoir-regex 1.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | Metadata-Version: 1.0
Name: hachoir-regex
Version: 1.0.5
Summary: Manipulation of regular expressions (regex)
Home-page: http://bitbucket.org/haypo/hachoir/wiki/hachoir-regex
Author: Victor Stinner
Author-email: UNKNOWN
License: GNU GPL v2
Download-URL: http://bitbucket.org/haypo/hachoir/wiki/hachoir-regex
Description: Hachoir regex
=============
hachoir-regex is a Python library for regular expression (regex or regexp)
manupulation. You can use a|b (or) and a+b (and) operators. Expressions are
optimized during the construction: merge ranges, simplify repetitions, etc.
It also contains a class for pattern matching allowing to search multiple
strings and regex at the same time.
Website: http://bitbucket.org/haypo/hachoir/wiki/hachoir-regex
Changelog
=========
Version 1.0.5 (2010-01-28)
* Create a MANIFEST.in to include extra files: regex.rst, test_doc.py, etc.
* Create an INSTALL file
Version 1.0.4 (2010-01-13)
* Support \b (match a word)
* Fix parser: support backslash in a range, eg. parse(r"[a\]x]")
Version 1.0.3 (2008-04-01)
* Raise SyntaxError on unsupported escape character
* Two dot atoms are always equals
Version 1.0.2 (2007-07-12)
* Refix PatternMatching without any pattern
Version 1.0.1 (2007-06-28)
* Fix PatternMatching without any pattern
Version 1.0 (2007-06-28)
* First public version
Regex examples
==============
Regex are optimized during their creation:
>>> from hachoir_regex import parse, createRange, createString
>>> createString("bike") + createString("motor")
<RegexString 'bikemotor'>
>>> parse('(foo|fooo|foot|football)')
<RegexAnd 'foo(|[ot]|tball)'>
Create character range:
>>> regex = createString("1") | createString("3")
>>> regex
<RegexRange '[13]'>
>>> regex |= createRange("2", "4")
>>> regex
<RegexRange '[1-4]'>
As you can see, you can use classic "a|b" (or) and "a+b" (and)
Python operators. Example of regular expressions using repetition:
>>> parse("(a{2,}){3,4}")
<RegexRepeat 'a{6,}'>
>>> parse("(a*|b)*")
<RegexRepeat '[ab]*'>
>>> parse("(a*|b|){4,5}")
<RegexRepeat '(a+|b){0,5}'>
Compute minimum/maximum matched pattern:
>>> r=parse('(cat|horse)')
>>> r.minLength(), r.maxLength()
(3, 5)
>>> r=parse('(a{2,}|b+)')
>>> r.minLength(), r.maxLength()
(1, None)
Pattern maching
===============
Use PatternMaching if you would like to find many strings or regex in a string.
Use addString() and addRegex() to add your patterns.
>>> from hachoir_regex import PatternMatching
>>> p = PatternMatching()
>>> p.addString("a")
>>> p.addString("b")
>>> p.addRegex("[cd]")
And then use search() to find all patterns:
>>> for start, end, item in p.search("a b c d"):
... print "%s..%s: %s" % (start, end, item)
...
0..1: a
2..3: b
4..5: [cd]
6..7: [cd]
You can also attach an objet to a pattern with 'user' (user data) argument:
>>> p = PatternMatching()
>>> p.addString("un", 1)
>>> p.addString("deux", 2)
>>> for start, end, item in p.search("un deux"):
... print "%r at %s: user=%r" % (item, start, item.user)
...
<StringPattern 'un'> at 0: user=1
<StringPattern 'deux'> at 3: user=2
Installation
============
With distutils:
sudo ./setup.py install
Or using setuptools:
sudo ./setup.py --setuptools install
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Interpreters
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Classifier: Topic :: Utilities
|