- 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
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
What is difference between '.' , '?' and '*' in Python regular expression?
Special character dot '.'
(Dot.) In the default mode, this matches any character except a newline. If the DOTALL flag has been specified, this matches any character including a newline.
Special character '?'
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ab? will match either ‘a’ or ‘ab’
Special character asterisk'*"
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many repetitions as are possible. ab* will match ‘a’, ‘ab’, or ‘a’ followed by any number of ‘b’s.
- Related Articles
- What is a regular expression in Python?
- What is Raw String Notation in Python regular expression?
- What is the difference between re.search() and re.findall() methods in Python regular expressions?
- What is regular expression in Java?
- What are regular expression repetition cases in Python?
- What does “?:” mean in a Python regular expression?
- Regular Expression Modifiers in Python
- Regular Expression Patterns in Python
- Regular Expression Examples in Python
- Regular Expression Matching in Python
- Regular Expression in Python with Examples?
- What are repeating character classes used in Python regular expression?
- Explain the relationship between Finite Automata and Regular Expression.
- What is the Python regular expression to check if a string is alphanumeric?
- How regular expression modifiers work in Python?