All pastes #172567 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-16 05:39 UTC
rendered paste body
allRegexps = (
  ('plantRegex',   re.compile('^(Plant:)(.*)')),  
  ('kernelRegex',  re.compile('^(Kernel:)(.*)')),
  ('updateRegex',  re.compile('^(Update:)(.*)')),
  ('archRegex',    re.compile('^(Architecture:)(.*)')),
  ('providesRegex',re.compile('^(Provides:)(.*)')),
  ('dependsRegex', re.compile('^(Dependes:)(.*)')),
  ('filesRegex',   re.compile('^(Files:)(.*)')),
)
  
for line in plantData:
    tab = line.strip()
    if tab == "" and plant != 0:
        continue

    for name, regex in allRegexps:
      m = oneRegex.match(tab)
      if m:
        print "found " + name
        # do something with m.group()
        break

    # and so on ...