Issue #22493: Warning message emitted by using inline flags in the middle of
regular expression now contains a (truncated) regex pattern.
Patch by Tim Graham.
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 4a77f0c..3d38673 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -735,8 +735,13 @@
                     if flags is None:  # global flags
                         if pos != 3:  # "(?x"
                             import warnings
-                            warnings.warn('Flags not at the start of the expression',
-                                          DeprecationWarning, stacklevel=7)
+                            warnings.warn(
+                                'Flags not at the start of the expression %s%s' % (
+                                    source.string[:20],  # truncate long regexes
+                                    ' (truncated)' if len(source.string) > 20 else '',
+                                ),
+                                DeprecationWarning, stacklevel=7
+                            )
                         continue
                     add_flags, del_flags = flags
                     group = None