On Friday, April 12, 2002, at 04:30 , Kris G Findlay wrote:
> i'm writing a script that takes data submited by a form and adds it to a
> mysql database
> but i would like to be able to preview the data as it is to be displayed
> before final submission to database. i have tried using hidden form
> fields within a prieview page
> but have a problem of these fields breacking when a " is included within
> the data
I ran into that as well.... What I had to do was write around it
#----------------------
# a simple step forward to allow for "Andy R" expressions
# a bit of overkill and all...
sub dtk_retArray {
my ($string) = @_;
my @list;
if ( $string =~ /".*"/ ) {
my $tmp = $string;
while ( $tmp ) {
if ( $tmp =~ s/^"([\w\s]*)"\s*(.*)/$1 $2/) {
$tmp = $2;
push(@list, $1);
} elsif ($tmp =~ s/(\w*)\s*(.*)/$1 $2/) {
$tmp = $2;
push(@list, $1);
}
}
} else {
@list = split(' ', $string);
}
@list;
} # end of dtk_retArray
I called that to check how a given textField had been set and
whether or not it had " marks " - the twisted part was noticing
that the way I had written the inner perl stuff meant that I
could write 'perl syntax' pattern matching
eg: search for "Andy R" or Andy\s*R ....
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]