fix file extension regex (#4510)

master
Nalin Bhardwaj 2017-09-28 23:10:31 +05:30 committed by PJ Hampton
parent 7b2bcd12d4
commit 4768a4d882
2 changed files with 9 additions and 1 deletions

View File

@ -186,7 +186,7 @@ handle query => sub {
return if $req->query_lc =~ /^0x/i; # hex maybe?
return if $query =~ /\d+(?:X|x)\.?$/; # websites such as 1337X
return if $query =~ /score$/;
return if $query =~ /^(?:\.\w+)/; # Probably looking at file extensions
return if ( $query =~ /^(?:\.\w+)/ && $query !~ $number_re); # Probably looking at file extensions
return if $query =~ $network; # Probably want to talk about addresses, not calculations.
return if $query =~ m/^(\+?\d{1,2}(\s|-)?|\(\d{2})?\(?\d{3,4}\)?(\s|-)?\d{3}(\s|-)?\d{3,4}(\s?x\d+)?$/; # Probably are searching for a phone number, not making a calculation
return if $query =~ m/^\(\d+\)\s+\d+\d+/;

View File

@ -387,6 +387,12 @@ ddg_goodie_test(
'fact 20' => build_test(
'20!'
),
'.32 * 100' => build_test(
'.32 * 100'
),
'.7 + .32' => build_test(
'.7 + .32'
),
## Trig testing
'tan 45' => build_test(
@ -551,6 +557,8 @@ ddg_goodie_test(
'2/3/09' => undef,
'21/12/2012' => undef,
'12/21/2012' => undef,
'.7zip * 100' => undef,
'.tar64 + 0.3' => undef,
);
done_testing;