regular expression

Wiebke Pätzold wiebke.paetzold at mplusr.de
Thu Jul 31 07:16:06 EDT 2003


Hi all,

I wrote a little program. Here it is:

import sys
import Mk4py

db = Mk4py.storage("c:\\datafile.mk",1)
vw = db.view("people")

def func(row):
    try:
        if row.Nachname[0:1]=='G':
            return 1
        else:
            return 0
    except AttributeError:
        return 0


vf = vw.filter(func)

for r in vf:
    print  vw[r.index].Nachname,vw[r.index].Kongressbereich
    

I create a database that contains a table. 'Nachname' and
'Kongressbereich' are special fieldnames. This program can search for
a special letter. In my example it is 'G'. and the search takes place
in 'Nachname'.
Mow I want to use regular expression. So that I can limit my search.
For example: I can search for Ge and it is not relevant wich letters
follow
Could somebody help me with this task?

Wiebke




More information about the Python-list mailing list