Delimited fields bug

Joel Palmius <[email protected]> Wed, 28 Nov 2007 16:22:03 +0100 (CET)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
Ok, I've fixed the bug with pipe signs in delimited fields. It was a 
regular expression quirk.

The below fix will appear in the next release. To apply manually, edit 
DelimitiedFields.pm so that

   sub SanityParse
   {
     my ($self, $string) = @_;

     # Replace delimiter if through data
     my ($d) = $self->{DELIMITER};

     if ($d eq " ")
     {
       $string =~ s/$d/\_/g;


instead reads:


   sub SanityParse
   {
     my ($self, $string) = @_;

     # Replace delimiter if through data
     my ($d) = $self->{DELIMITER};

     # Escape "dangerous" delimiters
     $d =~ s/([\.\+\\\$\^\(\)\[\]\{\}\*])/\\$1/g;

     if ($d eq " ")
     {
       $string =~ s/$d/\_/g;


The theoretical explanation is that the regular expression interpreted the 
contents of the $d variable so that "active" regexp chars were executed. 
This caused problem with the characters .+$\^()[]{}* (and possibly others 
I have not found yet).

   // Joel
Skickat av Joel Palmius <[email protected]>
till survey-discussion