From: minima Date: Sat, 7 Jan 2006 18:22:17 +0000 (+0000) Subject: improve shellregex handling a bit esp. for SQL stuff X-Git-Tag: R_1_52~44 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=9335fc83d6c885d49ac336e7058a5d5657da97cd;p=spider.git improve shellregex handling a bit esp. for SQL stuff --- diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index 0728c650..6908a527 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -173,8 +173,13 @@ if ($pre) { } } unless (@ans) { - $pre .= '*' unless $pre =~ /[\*\?\[]/o; + $pre .= '*' unless $pre =~ /[\*\?\[]$/o; $pre = shellregex($pre); + if ($main::dbh) { + $pre =~ s/\.\*/%/g; + } else { + $pre =~ s/\.\*\$$//; + } $expr = "\$f1 =~ m{$pre}"; $pre =~ s/[\^\$]//g; $hint = "m{\U$pre}"; @@ -245,6 +250,11 @@ if ($spotter) { $expr .= ' && ' if $expr; $spotter .= '*' unless $spotter =~ /[\*\?\[]/o; $spotter = shellregex($spotter); + if ($main::dbh) { + $spotter =~ s/\.\*/%/g; + } else { + $spotter =~ s/\.\*\$$//; + } $expr .= "\$f4 =~ m{\U$spotter}"; $hint .= ' && ' if $hint; $spotter =~ s/[\^\$]//g; diff --git a/perl/DXSql.pm b/perl/DXSql.pm index fcf4e4ce..a2194a7b 100644 --- a/perl/DXSql.pm +++ b/perl/DXSql.pm @@ -170,7 +170,7 @@ sub spot_search $expr =~ s/\$f9/spotcq/g; $expr =~ s/\|\|/ or /g; $expr =~ s/\&\&/ and /g; - $expr =~ s/=~\s+m\{\^([\w]+)[^\}]*\}/ like '$1%'/g; + $expr =~ s/=~\s+m\{\^([%\w]+)[^\}]*\}/ like '$1'/g; } else { $expr = ''; }