hachoir-regex

Regex manipulation Python library
Download

hachoir-regex Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Victor Stinner
  • Publisher web site:
  • http://fusil.hachoir.org/trac

hachoir-regex Tags


hachoir-regex Description

Regex manipulation Python library hachoir-regex application is regex manipulation Python library. It's used by hachoir-subfile for fast pattern matching (find file header). ExamplesRegex creation>>> from hachoir_core.regex import parse, createString>>> createString("bike") | createString("motor")< RegexOr '(bike|motor)' >>>> createString("big ") + createString("bike")< RegexString 'big bike' >>>> r=parse('(cat|horse)')>>> r.minLength(), r.maxLength()(3, 5)Optimizations>>> from hachoir_core.regex import parse, createString>>> parse("(ma|mb|mc)")< RegexAnd 'm' >>>> createString("moto") | parse("mot.")< RegexAnd 'mot.' >Pattern matchingfrom hachoir_core.regex import PatternMatchingp = PatternMatching()p.addString("un", 1)p.addString("deux", 2)p.addRegex("(trois|three)", 3)for start, end, item in p.search("un deux trois"): print "%r at %s: user=%r" % (item, start, item.user)find< StringPattern 'un' > at 0: user=1< StringPattern 'deux' > at 3: user=2< RegexPattern 't(rois|hree)' > at 8: user=3 Requirements: · Python What's New in This Release: · refix PatternMatching without any pattern


hachoir-regex Related Software