aa aa wrote:
Hi everyone,
Hello,
I get an string from an filename, and then create an mysql table using that filename. Since the rule is different, eg, a file name AA3bb.cc is ok but it can't used as a mysql table's name. So that I will modify that file name to AA3bb-cc. That means if any character in the filename !~ /[0-9a-zA-Z\-\_]/, then replace that character to hyphen "\-". Could anyone hlep me to code an perl regular expression to "replace that character to hyphen \-":if ($filename !~ /[0-9a-zA-Z\-\_]/){replace that character to hyphen "\-"}
$filename =~ tr/0-9a-zA-Z_/-/c; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/