in reply to Acceptable regular expressions within command line type syntax

Well, to begin with, in your second example, you don't put a \ before the d+. But let's assume that you meant to: The trick to this is to realize that the shell does not interpolate single quotes(') just like perl so always remember to do this:

perl -le '$PATH="test"; print $PATH' #outputs: test

rather than:

perl -le "$PATH='test'; print $PATH" #which gives and error when it interpolates $PATH to the #environment variable in the assignment operator

HTH

Addendum: Strike that, too early in the morning, can't regex just anywhere like other's have stated. The rest is valid and possibly useful even.