Reading: Learning Ext JS – Regular Expressions
I figured I might as well create my first real (and fairly useless) blog entry.
I’m reading Learning Ext JS since I’m trying to… well… learn Ext JS. So far it’s been pretty basic stuff (I’m only on Chapter 3). Then I came across this paragraph:
If you’re like me, regular expressions can leave you in a stupefied gaze at your monitor, so I always try to find something that is close to what I need and then modify it, rather than start from scratch.
What a horrible thing to write and/or teach to anyone.
I understand regular expressions are difficult. I remember when Igor taught them to me and all I saw was a lot of /^\s*([^\t]+?).*$/ crap (yes, that is a valid regular expression). But how could anyone suggest trying to hack at someone’s existing RE? Each expression has a very specific purpose. It’s probably harder trying to modify an existing one than it is to learn regular expressions.
You could write 200 lines of code to parse some text and have someone that knows REs come behind you and say, “yeah, you could do that in about 4 lines of code.”