Filter regex characters.
This commit is contained in:
1 parent
bec120c70f
commit
4eb157ad8e
1 file changed
+11
-2
+11
-2
@@ -121,7 +121,16 @@ sub cmd_qdb
|
|||||||
my $quotes = $dbq->fetchall_hashref('quoteid') or return;
|
my $quotes = $dbq->fetchall_hashref('quoteid') or return;
|
||||||
|
|
||||||
# Set expression.
|
# Set expression.
|
||||||
my $expr = join ' ', @argv[1 .. $#argv];
|
my $expr = my $rexpr = join ' ', @argv[1 .. $#argv];
|
||||||
|
$rexpr =~ s{\(}{\\\(}g;
|
||||||
|
$rexpr =~ s{\)}{\\\)}g;
|
||||||
|
$rexpr =~ s{\?}{\\\?}g;
|
||||||
|
$rexpr =~ s{\*}{\\\*}g;
|
||||||
|
$rexpr =~ s{\[}{\\\[}g;
|
||||||
|
$rexpr =~ s{\]}{\\\]}g;
|
||||||
|
$rexpr =~ s{\.}{\\\.}g;
|
||||||
|
$rexpr =~ s{\$}{\\\$}g;
|
||||||
|
$rexpr =~ s{\^}{\\\^}g;
|
||||||
|
|
||||||
# Clear the buffer.
|
# Clear the buffer.
|
||||||
@BUFFER = ();
|
@BUFFER = ();
|
||||||
@@ -129,7 +138,7 @@ sub cmd_qdb
|
|||||||
# Iterate through all quotes.
|
# Iterate through all quotes.
|
||||||
foreach my $qkt (keys %$quotes) {
|
foreach my $qkt (keys %$quotes) {
|
||||||
# Check if we have a match.
|
# Check if we have a match.
|
||||||
if ($quotes->{$qkt}->{quote} =~ m{$expr}ixsm) {
|
if ($quotes->{$qkt}->{quote} =~ m/$rexpr/ixsm) {
|
||||||
# Match. Add to buffer.
|
# Match. Add to buffer.
|
||||||
push @BUFFER, "\2ID:\2 $qkt - ".$quotes->{$qkt}->{quote};
|
push @BUFFER, "\2ID:\2 $qkt - ".$quotes->{$qkt}->{quote};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user