[Koha-bugs] [Bug 28316] Fix ES crashes related to various punctuation characters

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Sep 2 09:14:06 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28316

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.druart+koha at gmail.
                   |                            |com

--- Comment #91 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
+        $term =~ s/(?<!\\)((?:[\\]{2})*)(\{|\[)([^\s\[\]\{\}]+ TO
[^\s\[\]\{\}]+(?<!\\)(?:[\\]{2})*)(\}|\])/$1.'~~L'.($2 eq '[' ?
'S':'C').'~~'.$3.'~~R'.($4 eq ']' ? 'S':'C').'~~'/ge;



+            $term =~ s@(
+                (?<!\\)(?:[\\]{2})*/
+                (?:[^/]+|(?<=\\)(?:[\\]{2})*/)+
+                (?<!\\)(?:[\\]{2})*/
+            )$lookahead@"~~XI$rgx_i~~"@ex


I can push this kind of stuffs if everybody agrees, but I must warn that we are
opening a sensible door. If we find regressions that will be a mess to
maintain, or even to enhance.

Questions and suggestions:
1. Could we use named capture in the regexs?
2. What means XI?
3. Why do we need the 'e' modifier in the second one?
4. Can we split on several lines the regexs to make them more readable? (/xms)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list