Yes, but you have to OR them together:

x = re.findall(pattern=r'CAT.+?END', string='Cat \n eND', flags=re.I | re.DOTALL)
Answer from mipadi on Stack Overflow
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ re.html
re โ€” Regular expression operations โ€” Python 3.14.3 ...
Matches characters considered alphanumeric in the ASCII character set; this is equivalent to [a-zA-Z0-9_]. If the LOCALE flag is used, matches characters considered alphanumeric in the current locale and the underscore. ... Matches any character which is not a word character. This is the opposite of \w. By default, matches non-underscore (_) characters for which str.isalnum() returns False.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ howto โ€บ regex.html
Regular Expression HOWTO โ€” Python 3.14.3 documentation
Multiple flags can be specified by bitwise OR-ing them; re.I | re.M sets both the I and M flags, for example. Hereโ€™s a table of the available flags, followed by a more detailed explanation of each one. ... Perform case-insensitive matching; character class and literal strings will match letters by ignoring case.
๐ŸŒ
PYnative
pynative.com โ€บ home โ€บ python โ€บ regex โ€บ python regex flags
Python Regex Flags (With Examples) โ€“ PYnative
April 13, 2021 - In the first call of a re.search() method, DOT didnโ€™t recognize the \n and stopped matching. After adding the re.S option flag in the next call, The dot character matched the entire string.
๐ŸŒ
Johnlekberg
johnlekberg.com โ€บ blog โ€บ 2020-03-11-regex-flags.html
Using regular expression flags in Python
Regex flags allow useful regex features to be turned on. E.g. Allow case-insensitive matching so that "dave" is treated the same as "Dave". ... VERBOSE. Allow inline comments and extra whitespace. IGNORECASE. Do case-insensitive matches.
๐ŸŒ
Guru99
guru99.com โ€บ home โ€บ python โ€บ python regex: re.match(), re.search(), re.findall() with example
Python RegEx: re.match(), re.search(), re.findall() with Example
August 13, 2025 - This flags can modify the meaning of the given Python Regex pattern. To understand these we will see one or two example of these Flags. ... In multiline the pattern character [^] match the first character of the string and the beginning of each line (following immediately after the each newline).
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ python regex โ€บ python regex flags
Python Regex Flags
December 9, 2021 - The following example shows how to use the re.VERBOSE flag to write a pattern in sections with comments: import re s = 'Python 3' pattern = r'''^(\w+) # match one or more characters at the beginning of the string \s* # match zero or more spaces (\d+)$ # match one or more digits at the end of the string''' l = re.findall(pattern, s, re.VERBOSE) print(l)Code language: Python (python)
๐ŸŒ
Xah Lee
xahlee.info โ€บ python โ€บ python_regex_flags.html
Python: Regex Flags
Many Python Regex Functions and Regex Methods take a optional argument called โ€œflagsโ€. The flags modifies the meaning of the given regex pattern. The flags can be any of: To specify more than one of them, use | operator to connect them. e.g. re.search(pattern, string,flags=re.IGNORECASE|re.MULTILINE|re.UNICODE). Indicates case-insensitive matching.
Find elsewhere
๐ŸŒ
LearnByExample
learnbyexample.github.io โ€บ py_regular_expressions โ€บ flags.html
Flags - Understanding Python re(gex)?
This chapter showed some of the flags that can be used to change the default behavior of RE definition. And more special groupings were covered. 1) Remove from the first occurrence of hat to the last occurrence of it for the given input strings. Match these markers case insensitively.
๐ŸŒ
Hyperskill
hyperskill.org โ€บ learn โ€บ step โ€บ 14243
Regexp flags in Python
Hyperskill is an educational platform for learning programming and software development through project-based courses, that helps you secure a job in tech. Master Python, Java, Kotlin, and more with real-world coding challenges.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Regular Expressions in Python: the re Module | note.nkmk.me
May 9, 2023 - You can also use the inline flag (?i) or the abbreviation re.I. ... By default, it only matches the start of the entire string.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_regex.asp
Python RegEx
Python has a built-in package called re, which can be used to work with Regular Expressions. ... You can add flags to the pattern when using regular expressions. A special sequence is a \ followed by one of the characters in the list below, and has a special meaning: A set is a set of characters inside a pair of square brackets [] with a special meaning: The findall() function returns a list containing all matches...
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ python regex flags
Python Regex Flags - Be on the Right Side of Change
November 18, 2020 - In many Python regex functions, you see a third argument flags. What are they and how do they work? Flags allow you to control the regular expression engine. Because regular expressions are so powerful, they are a useful way of switching on and off certain features (e.g. whether to ignore capitalization when matching ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-flags-to-tune-the-behavior-of-regular-expressions
Python Flags to Tune the Behavior of Regular Expressions - GeeksforGeeks
October 1, 2020 - Python offers some flags to modify the behavior of regular expression engines. Let's discuss them below: ... The re.IGNORECASE allows the regular expression to become case-insensitive. Here, the match is returned based on the case of the provided string, not the string in the regular expression.
๐ŸŒ
Real Python
realpython.com โ€บ regex-python
Regular Expressions: Regexes in Python (Part 1) โ€“ Real Python
October 21, 2023 - To make this match as expected, escape the space character with a backslash or include it in a character class, as shown on lines 7 and 9. As with the DOTALL flag, note that the VERBOSE flag has a non-intuitive short name: re.X, not re.V. ... Get a short & sweet Python Trick delivered to your ...
๐ŸŒ
Medium
gaurav-patil21.medium.com โ€บ tutorial-7-regular-expressions-in-python-understanding-regex-flags-1ab7b7073fca
Tutorial 7 : Regular Expressions in Python- understanding regex flags | by Gaurav Patil | Medium
August 28, 2022 - By default, โ€˜$โ€™ matches at the end of the last line only in case of multiline text. This re.MULTILINE flag enables to do multiline matching.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ home โ€บ python โ€บ python regular expressions
Python Regular Expressions
February 21, 2009 - Python's re module provides useful functions for finding a match, searching for a pattern, and substitute a matched string with other string etc. This function attempts to match RE pattern at the start of string with optional flags.
๐ŸŒ
Real Python
realpython.com โ€บ regex-python-part-2
Regular Expressions: Regexes in Python (Part 2) โ€“ Real Python
June 16, 2023 - In the above example, re.search() matches when the digits are both at the beginning of the string and in the middle, but re.match() matches only when the digits are at the beginning. Remember from the previous tutorial in this series that if <string> contains embedded newlines, then the MULTILINE flag causes re.search() to match the caret (^) anchor metacharacter either at the beginning of <string> or at the beginning of any line contained within <string>:
๐ŸŒ
Google
developers.google.com โ€บ google for education โ€บ python โ€บ python regular expressions
Python Regular Expressions | Python Education | Google for Developers
In Python a regular expression search is typically written as: ... The re.search() method takes a regular expression pattern and a string and searches for that pattern within the string. If the search is successful, search() returns a match object or None otherwise.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-use-re-findall-in-python-to-find-all-matching-substrings-415132
How to use re.findall() in Python to find all matching substrings | LabEx
Let's explore some common flags. ... import re text = """ Python is a great language. PYTHON is versatile. python is easy to learn. """ ## Case-sensitive search (default) matches_case_sensitive = re.findall(r"python", text) ## Case-insensitive search using re.IGNORECASE flag matches_case_insensitive = re.findall(r"python", text, re.IGNORECASE) print("Original text:") print(text) print("\nCase-sensitive matches:", matches_case_sensitive) print("Case-insensitive matches:", matches_case_insensitive) ## Using the multiline flag multiline_text = "First line\nSecond line\nThird line" ## Find lines starting with 'S' starts_with_s = re.findall(r"^S.*", multiline_text, re.MULTILINE) print("\nMultiline text:") print(multiline_text) print("\nLines starting with 'S':", starts_with_s)