Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Fix overtriggering. (#4457)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjhampton authored and moollaza committed Aug 28, 2017
1 parent 242793b commit d0b3a24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/DDG/Goodie/Calculator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ handle query => sub {
return if $query =~ m/^\)|\($/; # shouldn't open with a closing brace or finish with an opening brace
return if $query =~ m/(a?cosh?|tau|a?sin|a?tan|log|ln|exp|tanh|cbrt|cubed?)e?$/i; # stops empty functions at end or with <func>e
return if $query =~ m#(?:x(\^|/)|(\^|/)x)#; # stops triggering on what is most likely algebra
return if $query =~ m#^0\d+/\d+$#;

# some shallow preprocessing of the query
$query =~ s/^(?:what is|calculat(e|or)|solve|math)//i;
Expand Down
1 change: 1 addition & 0 deletions t/Calculator.t
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ ddg_goodie_test(
')1108278829' => undef,
'24score' => undef,
'24 score' => undef,
'06026/6126' => undef,
);

done_testing;

0 comments on commit d0b3a24

Please sign in to comment.