Simple regex with whitespaces

James Stroud jstroud at
Mon Sep 11 23:38:54 CEST 2006

Paul McGuire wrote:
> <mathieu.malaterre at> wrote in message 
> news:1157945804.805624.32620 at
>> I cannot figure out a way to find a regular expression that would
>>match one and only one of these two strings:
>>Any suggestion ? Thanks a bunch !
> A pyparsing approach is not as terse as regexp's, but it's not terribly long 
> either.

To second Paul's suggestion, usually, if the regex is not immediately 
obvious, its probably better to look into parsing modules, pyparsing 
being one of the most accessible modules (to me, anyways)--and well 
worth learning.

However, in complicated applications, regex is usually still fun and 
valuable as an intellectual exercise.


James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

More information about the Python-list mailing list