Home > ExtJS > Reading: Learning Ext JS – Regular Expressions

Reading: Learning Ext JS – Regular Expressions

March 22nd, 2009

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.”

ExtJS

  1. June 11th, 2009 at 07:45 | #1

    It comes down to simple time management, most regex’s you would need on a daily basis have already been written – why reinvent the wheel?

    The unfortunate fact is that most programmers can’t write a regex from scratch, and tend to work backwards to gain an understanding of them, starting with something that exists and tailoring it to their needs. The long term goal is the same, to learn “how to do it”.

  1. No trackbacks yet.