[Baypiggies] More dramatic material?

Aahz aahz at pythoncraft.com
Wed Feb 24 16:36:35 CET 2010

On Wed, Feb 24, 2010, Glen Jarvis wrote:
> I'm always trying to fill in the fundamentals and I've been learning to 
> do fairly sophisticated regex's the past six months... However, my  
> fundamental question of 'why use it on Python' has been echoing in my  
> mind more and more with this conversation. Richard Pixley gave a few  
> reasons other than performance.

Ah.  Well, here are a couple of regexes that I've used recently in vim
(the first one relies on some vim extensions to vi):

:s/(\=\([0-9][0-9][0-9]\))\=[ ./]*\([0-9][0-9][0-9]\)[ .\-]*\([0-9][0-9][0-9][0-9]\)/\1-\2-\3/
/COMPANY_NAME.*folder snap

(The first one is a regex I keep in my .exrc; the second one I typed in
on the fly to search a log file.  No-prize to the first person who
figures out what the first regex does.)

Generally speaking, regexes are good when you want to search for two
things at the same time or to use the result of a search in a replace
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

More information about the Baypiggies mailing list