Issue #22493: Inline flags now should be used only at the start of the
regular expression.  Deprecation warning is emitted if uses them in the
middle of the regular expression.
diff --git a/Lib/fnmatch.py b/Lib/fnmatch.py
index 07b1229..fd3b514 100644
--- a/Lib/fnmatch.py
+++ b/Lib/fnmatch.py
@@ -106,4 +106,4 @@
                 res = '%s[%s]' % (res, stuff)
         else:
             res = res + re.escape(c)
-    return res + r'\Z(?ms)'
+    return r'(?s:%s)\Z' % res