Re: [Rd] sqlSave reports invalid regular expression '[^[:alnum]_]+' (PR#7703)

From: Tony Plate <>
Date: Fri 25 Feb 2005 - 04:57:16 EST

I suspect that the error message is now correct, AFAIK, the correct syntax for that regular expression is '[^[:alnum:]_]' (your version is missing the second colon). Looks like the previous version of R did just not give you a error message that the regular expression was invalid (and you might want to consider what it was doing with that expression -- probably not what was intended.)

Apparently this regular expression is defined in the function mangleColNames() in the package RODBC. When I look at RODBC I see a correct regular expression in mangleColNames() -- have you perhaps an old or corrupt version of the RODBC package?

 > getAnywhere("mangleColNames")
A single object matching 'mangleColNames' was found It was found in the following places

with value

function (colnames)
gsub("[^[:alnum:]_]+", "", colnames)
<environment: namespace:RODBC>

My copy of RODBC has the following info:

                 Information on Package 'RODBC'


Package:              RODBC
Version:              1.1-3
Date:                 2005-02-05
Author:               Originally Michael Lapsley
                       <>, since Oct 2002
                       B. D. Ripley <>
Maintainer:           B. D. Ripley <>
Title:                ODBC database access
Description:          An ODBC database interface
SystemRequirements:   An ODBC driver manager and drivers. See README.
Depends:              R (>= 1.9.0)
License:              GPL2
Packaged:             Mon Feb 7 08:32:20 2005; ripley
Built:                R 2.0.1; i386-pc-mingw32; 2005-02-08 12:21:23;

At Thursday 10:37 AM 2/24/2005, wrote:
>Full_Name: David Whiting
>Version: 2.1.0 Under development (unstable)
>OS: linux
>Submission from: (NULL) (
>I have just upgraded from a previous version (2.0.0?) and found some of my
>that used okay to run now gives an error. The function being called is
>sqlSave(). I am pretty sure (but not 100% certain) that the data frame I am
>trying to save has not changed. I am 100% sure that the ODBC connection
>information for MySQL has not changed and I have not updated MySQL.
> > sqlSave(lh, data, "survey")
>Error in gsub(pattern, replacement, x,, extended, fixed) :
> invalid regular expression '[^[:alnum]_]+'
> > traceback()
>4: gsub("[^[:alnum]_]+", "", colnames)
>3: mangleColNames(names(colspecs))
>2: sqltablecreate(tablename, colspecs = colspecs, keys = keys)
>1: sqlSave(lh, data, "survey")
> > str(data)
>`data.frame': 192 obs. of 171 variables:
>(I can send the whole structure if that will help)
> > version
> _
>platform i686-pc-linux-gnu
>arch i686
>os linux-gnu
>system i686, linux-gnu
>status Under development (unstable)
>major 2
>minor 1.0
>year 2005
>month 02
>day 24
>language R
> >
> mailing list
> mailing list Received on Fri Feb 25 04:04:37 2005

This archive was generated by hypermail 2.1.8 : Fri 25 Feb 2005 - 04:32:26 EST