PDA

View Full Version : python re module: how does it work?



flyingsliverfin
February 11th, 2011, 09:31 PM
How does the python 're' module work? We just had a programming contest at school that needed pattern matching and i felt like i was cheating by using re... So now im wondering how i can code re myself, for which i need an understanding of how it works. Im a beginner-intermediate python user and have used the basics to do a lot but haven't gone things beyond functions (so havent done classes yet)

Vaphell
February 11th, 2011, 09:55 PM
regex theory is serious business, my advice: don't go there

but if you really really want - code is here:
/usr/lib/python2.6/re.py

juancarlospaco
February 11th, 2011, 10:50 PM
Very serious business...
http://xkcd.com/208/

MadCow108
February 11th, 2011, 11:19 PM
this site explains how it works internally a bit in its tutorial.
http://www.regular-expressions.info/
its also a good resource for regex in general