Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Apple

Journal pvera's Journal: Regular Expressions and Grep

This last week or so has turned into an incredible discovery journey. I have used regular expressions in the past for very specific purposes, and 99% of these involved validating an email address. REGEX in ASP is a pain in the ass because it is not native to vbscript, sort of the same problem you would have trying to parse xml from within asp using vbscript.

A while ago (when I switche to Mac OS X) I discovered how pretty freakin cool is to use regular expressions to hunt down html and xml tag pairs. These regular expressions combined with aplescript translated into great time savings for the humongous web forms I do 3-5 times a week for my employer's online research surveys.

What happened last week is that I decided to bump it up another notch. After a painful afternoon that I could not figure out jack squat, I suddenly figured out how the hell you can have a search pattern for n patterns and each of the n patters replaced with something different.

Pay dirt.

Now instead of spending 15 minutes running applescripts that save me a half hour of work, I run a single applescript that executes a half dozen regular expression transforms that so the whole godamn shebang in 15 FREAKING SECONDS.

Amazing.

The worst thing is that I am getting obsessed with the whole concept, and the sky is the limit. I have already applied it to a bunch of annoying little jobs that take 10-15 minutes apiece, but when you add them up that's at least an extra hour saved per day! This feels like the first time I figured out a select case in VB/Vbscript (or a switch in Java, C++, etc) works the exact same way as a bunch of IFs, but only it is 100 times easier to read.

The funny thing is that when taking this grep integration into BBEdit, Editplus is starting to look like the old, outdated piece of crap that it is. I love Edit Plus to death, but Jesus, these people need to get on with the freakin program! BBedit not only has a much better REGEX engine than EditPlus does, but it also allows you to use Perl scripts. Jeez!

This discussion has been archived. No new comments can be posted.

Regular Expressions and Grep

Comments Filter:

"If I do not want others to quote me, I do not speak." -- Phil Wayne

Working...