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

Commit

Permalink
Added regexp to match queries like "20% tip of 43.3".
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag Talon committed Oct 5, 2012
1 parent ab3bdff commit 7a09d97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/DDG/Goodie/Tips.pm
Expand Up @@ -4,7 +4,7 @@ use DDG::Goodie;
triggers any => 'tip', 'tips', '%';

handle query_lc => sub {
return unless my ($p, $is_tip, $sign,$num) = $_ =~/^(\d{1,3})(?: ?%| percent) (?:(tip (?:on|for))|of)(?: an?)? ([\$\-]?)(\d+(\.?)(?(5)\d+))(?: bill)?$/;
return unless my ($p, $is_tip, $sign,$num) = $_ =~/^(\d{1,3})(?: ?%| percent) (?:(tip (?:on|for|of))|of)(?: an?)? ([\$\-]?)(\d+(\.?)(?(5)\d+))(?: bill)?$/;
$p /= 100;
my $t = $p*$num;
my $tot;
Expand Down

0 comments on commit 7a09d97

Please sign in to comment.