Gossamer Forum
Home : Products : DBMan : Customization :

Removing double quotes from default.db

Quote Reply
Removing double quotes from default.db
I have found that many databases, such as filemaker pro and others, export their ASCII data with quotes around each individual field and also use a | to seperate the fields. What is the Regexp to remove the quotes from the database in realtime? Where do I place it so it elimates the double quotes from every field?

Here is an example from the database ASCII export:

Code:
"2"|"Project Management Institute"|"http://www.pmi.org"|"Web"|"09-Sep-1997"|"Project Management"|"Yes"|"admin"

P.S. I want it to eliminate it in realtime so that some idiot secretary (No offense intended) can just FTP the output to the server and not do anything else.

P.S.S. I am assuming that the RegExp I need to use is =~ s/"//; Is this correct?
Quote Reply
Re: Removing double quotes from default.db In reply to
 

Well, then we did each other a good turn today. I told you how to get rid of the quotation marks, and you gave me a really good laugh!!


------------------
JPD





Quote Reply
Re: Removing double quotes from default.db In reply to
The regular expression you would use is correct.

I suppose you could just add it to sub html_record and sub html_record form. In both subroutines, after

my (%rec) = @_;

add

Code:
foreach $col (@db_cols) {
$rec{$col} =~ s/"//g;
}

That would remove any quotation marks before the values of the fields are printed out.


------------------
JPD





Quote Reply
Re: Removing double quotes from default.db In reply to
Oh baby! It works beautifully! Smile

Thanks,
Lance Wilson
Quote Reply
Re: Removing double quotes from default.db In reply to
Hey! I've got a better solution. In the $db_delim section of the config file just do this:

$db_delim = '","';

It solves all the problems that may happen even when you try to modify a record, etc. I haven't found any errors with it yet.

Lance Wilson.
Quote Reply
Re: Removing double quotes from default.db In reply to
That is a bad choice of delimiter. What if you have a field that uses commas. It would screw up the whole database structure.

Just my two cents.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Removing double quotes from default.db In reply to
The other problem with it is that you will still have extra quotation marks at the beginning and the end of each record when you upload the records from the database.

It is better to strip the quotation marks.




------------------
JPD