Help needed with regular expressions

Darrin Chandler dwchandler at stilyagin.com
Wed Jan 25 18:39:23 MST 2006


Mike Garfias wrote:

>No silly song.
>
>The best way to start thinking regexes, is to use them.  Write a lot of perl
>:)
>
>I learned by doing regex search and replaces in VIM, and moved on from there.
>
>You might want to pick up the mastering regular expressions o'reilly book.
>
>John Wheat spoke forth with the blessed manuscript:
>  
>
>> I am seeking help to memorize, utilize, and gain basic proficiency 
>>with regular expressions and sed, grep, egrep searches and the like. 
>>When I read something like \^{a-r}\ my brain for lack of a bettwer way 
>>to say it believes this to be a ctl-d and stops all processing. So if 
>>you have a tool or an acronym or perhaps a silly song you have made up 
>>that would help me learn this aspect of CLI interaction would you please 
>>share that information with me.
>>    
>>

Yep, no silly songs will help here. Too much to learn!

But... you can start simple and get more complex later. Sprinkle print 
statements liberally through your code so you can see what's going on. 
Nothing's more frustrating than fiddling for hours with one regex only 
to find out that the problem is in a different one. Build up your regex 
in stages, narrowing down to just what you need.

As Mike says, regex search and replace is a great interactive way to 
polish your skills.

man perlre!

-- 
Darrin Chandler            |  Phoenix BSD Users Group
dwchandler at stilyagin.com   |  http://bsd.phoenix.az.us/
http://www.stilyagin.com/  |



More information about the PLUG-discuss mailing list