From 3f23d956f43f2fea226b5f58750dc406e39f7581 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 7 Jan 2006 18:22:17 +0000 Subject: [PATCH] improve shellregex handling a bit esp. for SQL stuff --- cmd/show/dx.pl | 12 +++++++++++- perl/DXSql.pm | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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 = ''; } -- 2.43.0