Regular Expressions for Regular Programmers

Have to agree with the Regex religiolos. Almost also bought Regex buddy because of you J, then realised the vast amount of power will destroy all the other possibilities. Remember; “you now have two problems”. That’s all for now, good post… I have not laughed with a blog post like this in a long time.

Cheers,
J

The most common gotcha I see with regular expressions is when programmers try to make them parse grammars that are more complex than a regular language. No matter how clever your regular expression, it simply cannot singlehandedly parse strings from a context-free, context-sensitive, or recursively enumerable language. Yet people try and try to enlist regular expressions for such tasks, often creating security vulnerabilities.

Ouch – Jeffrey Friedl

C’mon man! It was a challenge! Where’s your new Regular Expressions book? :slight_smile:

I use Jan Goyvaerts’ EditPad Pro and RegEx Buddy at work constantly. It is really amazing how much better/faster EditPad Pro is than every other text editor I have com across. Well worth the money (even if it pains you to pay money for a text editor).

You know, sometimes I wonder, whether you’re being paid to advertise these books.

I too love regular expressions… The process of writing one, for me at least, is so involved and arcane, and in the end you get this tiny, nearly indecipherable sequence of characters which is so packed with raw power.

I feel like a freaking wizard every time I make one. I want to shout to my fiancée, “Look, woman, behold the magic I have created!”

Of course, she just rolls her eyes and goes back to whatever it was I had the gall to interrupt her from.

How much are Jan and Stephen paying you?

Can Indians purchase e-books (and print them out) if they are purchased online? The Kindle has not arrived in India, AFAIK. While some books that the publishers think have demand make it to the market in Eastern Economy Editions which are sanely priced, many good books do not. If it costs $5 for a Starbucks coffee (maybe in a nice ambience) in the US, it costs INR 50 out here.
So if a book costs $25, it should roughly cost abt 250 here.
Some calculation of that sort - if you buy 1000 Regex books, it costs you an average monthly ordinary developer salary. Here the ordinary developer salary is INR 30,000. So I should be able to buy the Regex books at INR 30 apiece.
This is not accurate or correct. But let us say INR 150 per copy. Comes to $3. This is the disparity. Hence if the book has no EAstern Economy Edition, we have to buy it at $20 or whatever, online.
Tough on us to go straight way. Most people end up using torrents.
I suspect the rest of the world has similar reasons to make copies for cheap. This is not a programming problem, but it can have a solution which might come from programmers. Like we make a constantly updating, open-currency index based on livelihood expenses - bread, grains, water, power, etc, etc.

Alternatively, give me the book on bittorrent :stuck_out_tongue:

@Asmor: Brilliant. :slight_smile:

@Roger, et al: Seriously, I know we once all thought it was funny to accuse a blogger of getting a kickback any time they endorse something, but unless you have access to Mr. Atwood’s financial records, chill out already. If you have read the book and can endorse/counter-endorse it, groovy, otherwise no one wants to hear it.

An other way to keep regular expressions readible, is to use groups. The base2 library has the RegGrp-class for just that:

http://base2.googlecode.com/svn/doc/base2.html#/doc/!base2.RegGrp

Not sure why the Friedl book gets the cool wise Owl while Jan and
Steve get a freakin’ rat.

Shrew != rodent.

I am of two minds about your enthusiastic endorsement, Jeff. Good to know that there are additional learning resources for being able to create (and possibly even decipher) what looks like line noise. Unfortunately, however, better documentation will just encourage people to use more regular expressions. :slight_smile:

Ironic name though.

“Regular” expressions always struck me as particularly constipated code.

In portuguese (pt_BR), we have Aurelio Marinho Jargas’s book “Expressões Regulares - Uma Abordagem Divertida”. It uses the same principle: clear and concise expressions in every chapter, showing real world solutions: http://www.piazinho.com.br/
A little masterpiece in a language lacking good technical books.

@CynicalTyler
If you looked at the link to amazon it has a tracking tag on it.

What he’s doing with it I don’t care, but there’s definately a kickback here. Maybe he’s donating it all to orphans. Orphans with diseases.

Yes! Reg Ex rocks. I’m going to have to pick this one up…

I found the infallible logic of ConkCurrency irresistibly hilarious (not a good thing).

Jeff is going to get thousands of clicks on this one and a nice paycheck from amazon :slight_smile: Congrats :slight_smile:

Why wouldn’t you be able to purchase an ebook in India from the site in US? You can most certainly get a PDF.

You can also find the same material online: regular expressions in all shapes and sizes.

“Although Regular Expressions are really awesome, real men use (LA)LR parsers.”

Sane men use something like ANTLR with LL(k) parsing but EBNF grammars.

I wrote: > Or perhaps there’s another explanation…

Well, it looks as though speedy has in linked to Jeff’s site I see now (missed it 1st time around) I really wish these things were attributed more plainly…

Isn’t a musk shrew the most naturally sexy of all the creatures put on the front of these things? I mean, it’s got musk right there in the name. Sexah.

Regex is a hairy topic, the shrew fits in nicely.