Regular Expressions as an end-user programming tool?

“What? Have you completely lost the plot, Gleeson?”, I hear you scream.  Jamie Zawinski’s famous quote is intoned once more ..

Some people, when confronted with a problem, think
“I know, I’ll use regular expressions.”   Now they have two problems.

Of course the above quote could be (and probably has been) changed to…

Most business people, when confronted with a problem, think
“I know, I’ll use a spreadsheet.”   Now they have two problems.

They are dense, single-line, single purpose, self contained mini-programs.  The previous statement applies to regular expressions but could equally be used to describe the single most popular end-user programming tool, spreadsheet formulae (particularly in their nested form!).

As somebody with the “programming gene” (something most, but not all, IT professionals possess, as do a significant proportion of “civilians”), such compressed logic somewhat grates compared with the power and elegance of more expressive programming languages, but that hasn’t stopped me using both spreadsheet formulae and regex to quickly and effectively solve problems when the need arose.

Those without the programming gene (the vast majority of business users), find traditional programming languages next to impossible to get their heads around yet find spreadsheet formulae approachable and useful.  It seems to be something to do with approaching problems as a series of simple problems and not loading the whole problem domain into one’s brain at one sitting (as most programmers and system designers are capable of).

In the past, non-programmers would rarely come in contact with regex as its use was possible only within the realms of professional programming or Unix sys-admin toolsets (sed,awk etc.).  But now, ETL tools such as Kettle and Talend allow end-users to use regular expressions without the need to understand the underlying programming language.  Taking this to the next step, Talend’s new data profiling product uses regular expressions as its main discovery language. They could, I guess, have invented yet another XML dialect and/or query-by-example dialogue, but instead they’ve taken the sensible (and cheaper) option and exposed the full power of raw regular expressions.

Will the great unwashed embrace regex in the same way they took to nested Excel functions, embarrassing their professional colleagues with yet more amateurish and often unmaintainable messy solutions, that just work? I think they just might…

Advertisements

4 responses to “Regular Expressions as an end-user programming tool?

  1. Can you recommend any books for someone looking to break into learning regex?

    Thx,
    JP

  2. @JP

    I learned “on the job” (mainly from using AWK and Perl) but I’d guess any decent book on Perl would be a good place to start. There are however lots of Regex 101 sites on the net, for example…

    http://www.icewarp.com/support/online_manual/203030104.htm (very simple introduction)

    http://www.regular-expressions.info/ (a bit more info)

    http://www.editgrid.com/user/ken/REGEX_tutorial (regex in a spreadsheet!)

    to ..
    http://regexp.resource.googlepages.com/analyzer.html
    or
    http://osteele.com/tools/reanimator/
    …if you wish to see a visual analysis of your regular expressions.

    Tom

  3. Pingback: SAX and Bugs and XBRooL « Gobán Saor

  4. Pingback: microETL’s SQL function | Gobán Saor