
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to capture an exception raised by a Python Regular expression?
When the match method is implemented, if it turns out that there are no matches, then None is returned. There are no functions in the re module that throw up an exception when the list or matches is empty
exception re.error
Exception raised when a string passed to one of the functions here is not a valid regular expression (for example, it might contain unmatched parentheses) or when some other error occurs during compilation or matching. It is never an error if a string contains no match for a pattern.
- Related Articles
- How to get the number of capture groups in Python regular expression?
- How to capture and print Python exception message?
- How to capture divide by zero exception in Java?
- How to capture divide by zero exception in C#?
- How to capture null reference exception in C#?
- How to validate an email id using regular expression in Python?
- How to write a Python regular expression to use re.findall()?
- How to write a Python Regular Expression to validate numbers?
- How to capture file not found exception in Java?
- How to capture file not found exception in C#?
- How to capture out of memory exception in C#?
- How to use wildcard in Python regular expression?
- How to use range in Python regular expression?
- How to use variables in Python regular expression?
- How to match parentheses in Python regular expression?

Advertisements