in reply to Seduced by a Regex

There are three things I keep in mind with regard to regular expressions and efficiency. Number one: when looking for a static string index() is faster than regex (or so sez the Mastering Algorithms Book). Regex has an optimization that probably lets it work just like index() but it has some additional overhead to deal with since it's a more complex beastie. Number two: Ovid's Death to Dot Star!. Number three: there's a wonderful article on perl.com about 'sexegers' which is just applying a regex to the same data except backwards. This comes up occasionally so it's a neato trick. From here just get into things like unnessessary use of substitution, capturing and other nastiness.