Re: Delimited fields bug
Joel Palmius <[email protected]> Wed, 28 Nov 2007 16:36:45 +0100 (CET)
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
And, duh... Of course the pipe sign should be in there too. So:
$d =~ s/([\.\+\\\$\^\(\)\[\]\{\}\*\|])/\\$1/g;
I'll test again before release. :-)
// Joel
On Wed, 28 Nov 2007, Joel Palmius wrote:
> 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
>
Skickat av Joel Palmius <[email protected]>
till survey-discussion