Page 1 of 1

Help with regular expression and replacement string

Posted: Mon Oct 20, 2003 3:06 pm
by Icypher
Hello folks...

I am a very new Textpad user. I am trying to import a very large comma delimited text file into SQL Server 7.0. The problem I am having is the text file is written so that all fields have quotation marks surrounding them, declaring them as a character field. An example field would be:

...","619 "E" Street","...

Well you can see the problem. SQL barfs on the "E" because it cannot find the comma.

I am trying to use a regular expression in order to find and replace the above:

[:blank:]["][:alpha:]["][:blank:]

and replace it with

[:blank:][:alpha:][:blank:]

but as you probably guessed, it does not work. Any help would be greatly appreciated.

Posted: Mon Oct 20, 2003 3:28 pm
by MudGuard
[:blank:] and the others are for use inside a character class, they are NOT character classes of their own.

Also, the literal " does not need to be placed in a character class.

And last, you want to remember the different parts for reusing them in replacement.

Search for:
([[:blank:]])"([[:alpha:]])"([[:blank:]])

and replace by
\1\2\3