[Tutor] Re: Speaking of regular expressions

karl d'adamo karld@ugcs.caltech.edu
Thu Nov 28 16:30:01 2002


the second edition of the Friedl book was what i went through for an introduction to regular expressions for python.  i think the python implementation is similar in syntax to the java implementation so a lot of the examples are good.  plus, most of what is covered is the writing of the regular expression itself, and this is universally applicable (with many caveats, of course, depending on the specific tool).

also, the regular expressions howto [1] definitely fills in the syntactic gaps

[1] http://py-howto.sourceforge.net/regex/regex.html

On Fri, Nov 22, 2002 at 11:28:59AM -0500, Derrick 'dman' Hudson wrote:
 : On Fri, Nov 22, 2002 at 09:22:03AM +0100, Magnus Lycka wrote:
 : | At 21:53 2002-11-21 -0500, Derrick 'dman' Hudson wrote:
 : | >"Mastering Regular Expressions" by Jeffrey Friedl, published by
 : | >O'Reilly.
 : | >
 : | >The book is a bit dated now (for example the python-specific parts
 : | >refer to the 'regex' module which predates the 're' module)
 : | 
 : | Really?
 : | 
 : | The second edition is from July 2002.
 : 
 : Hmm, well, my comment is apparently quite dated :-).  My copy is First
 : Edition (Jan. 1997) Seventh Printing (Dec. 1998).
 : 
 : | The book is fairly Perl centric,
 : 
 : This shouldn't be a major drawback because, apart from the historical
 : syntax in grep, sed, awk and the like, most systems use
 : perl-compatible regexes now.
 : 
 : | but it seems that the author noticed the change in python.
 : 
 : I'd expect so :-).
 : 
 : Thanks Gregor and Magnus for pointing out the new edition.
 : 
 : 
 : For Bob :
 :     All I can say is look for the potential application of regular
 :     expressions in the problems you come across.  Then try and devise
 :     an expression that works for you.  One example is searching a file
 :     for certain data.  There you could use grep and/or sed to locate
 :     and reformat the data for use.
 : 
 : -D
 : 
 : -- 
 : The way of a fool seems right to him,
 : but a wise man listens to advice.
 :         Proverbs 12:15
 :  
 : http://dman.ddts.net/~dman/