http://qs321.pair.com?node_id=376403


in reply to Regular Expression Question

The . (dot) in your regular expression will match anything. You need to escape it, i.e.

$folder =~ /(\d{6}\.?\d{2}?\w?)/;


Also, this regular expression is matching for files which are of the form ######## (8 numbers without a dot), and files of the form ######a (6 numbers and the optional letter), as well as a few other forms that it sounds like you don't awnt to capture. Is the optional 2 digit number and letter dependent on whether there is a dot? If so, you are going to need a slightly more complex regular expression.

One last question, why do you even have the regular expression in there? Can't you use $folder instead of $1 without loss of generality? You aren't doing a conditional based on whether or not the regexp matches, so I assume all folders are meant to be replaced in...