Bug 29284: Handle the case of an exclamation point in parentheses

This expands the regex to handle this specific case

To test:
1 - Load record created for last patch
2 - Note analytics error
3 - Apply patch
4 - Restart and reload
5 - No more errorm also no Analytics link
6 - Add a 773$t to a record with title used before:
    Digger does it all (not really!)
7 - reload the initial record
8 - See 'Show analytics' link
9 - Click the link
10 - You should end up on the record you added the 773 to

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7c74eb9124)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Nick Clemens 2021-10-20 12:49:42 +00:00 committed by Victor Grousset/tuxayo
parent 6ec5e00e6a
commit ff0dce19a0
1 changed files with 1 additions and 1 deletions

View File

@ -986,7 +986,7 @@ sub clean_search_term {
$term =~ s/((?<!\\)(?:[\\]{2})*:[^:\s]+(?<!\\)(?:[\\]{2})*)(?=:)/$1\\/g;
# screen all exclamation signs that either are the last symbol or have white space after them
$term =~ s/(?:[\s\\]*!\s*)+(\s|$)/$1/g;
$term =~ s/(?:[\s\\]*!\s*)+(\s|$|\))/$1/g;
# screen all brackets with backslash
$term =~ s/(?<!\\)(?:[\\]{2})*([\{\}\[\]])$lookahead/\\$1/g;