-my ($self, $line) = @_;
-my @list = split /\s+/, $line; # split the line up
-
-my @out;
-my $f;
-my $call;
-my ($from, $to);
-my ($fromday, $today);
-my @freq;
-my @ans;
-my $pre;
-my $spotter;
-my $info;
-my $expr;
-my $hint;
-my $dxcc;
-my $fromdxcc;
-my ($doqsl, $doiota, $doqra);
-
-while ($f = shift @list) { # next field
- # print "f: $f list: ", join(',', @list), "\n";
- if (!$from && !$to) {
- ($from, $to) = $f =~ m|^(\d+)[-/](\d+)$|; # is it a from -> to count?
- next if $from && $to > $from;
- }
- if (!$to) {
- ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
- next if $to;
- }
- if (lc $f eq 'dxcc') {
- $dxcc = 1;
- next;
- }
- if (lc $f eq 'on' && $list[0]) { # is it freq range?
- # print "yup freq\n";
- if ($list[0] =~ m|^(\d+)(?:\.\d+)?[-/](\d+)(?:\.\d+)?$|) {
- push @freq, $1, $2;
- shift @list;
+require 5.10.1;
+use warnings;
+
+sub handle
+{
+ my ($self, $line) = @_;
+
+ # disguise regexes
+ $line =~ s/\{(.*)\}/'{'. unpack('H*', $1) . '}'/eg;
+ dbg("sh/dx disguise any regex: '$line'") if isdbg('sh/dx');
+
+ # now space out brackets and !
+ $line =~ s/([\(\!\)])/ $1 /g;
+
+ my @list = split /[\s]+/, $line; # split the line up
+
+ # put back the regexes
+ @list = map { my $l = $_; $l =~ s/\{([0-9a-fA-F]+)\}/'{' . pack('H*', $1) . '}'/eg; $l } @list;
+
+ dbg("sh/dx after regex return: " . join(' ', @list)) if isdbg('sh/dx');
+
+ my @out;
+ my $f;
+ my $call = $self->call;
+ my $usesql = $main::dbh && $Spot::use_db_for_search;
+ my ($from, $to) = (0, 0);
+ my ($fromday, $today) = (0, 0);
+ my $exact;
+ my $real;
+ my $dofilter;
+ my $pre;
+ my $dxcc;
+
+ my @flist;
+
+
+ dbg("sh/dx \@list: " . join(" ", @list)) if isdbg('sh/dx');
+
+ while ($f = shift @list) { # next field
+ dbg "sh/dx arg: $f list: " . join(',', @list) if isdbg('sh/dx');
+ if (!$from && !$to) {
+ ($from, $to) = $f =~ m|^(\d+)[-/](\d+)$|; # is it a from -> to count?
+ dbg("sh/dx from: $from to: $to") if isdbg('sh/dx');
+ next if $from && $to > $from;
+ }
+ if (!$to) {
+ ($to) = $f =~ /^(\d+)$/o if !$to; # is it a to count?
+ dbg("sh/dx to: $to") if isdbg('sh/dx');
+ next if $to;
+ }
+ if (lc $f eq 'day' && $list[0]) {
+ ($fromday, $today) = split m|[-/]|, shift(@list);
+ dbg "sh/dx got day $fromday/$today" if isdbg('sh/dx');