- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to write a Python regular expression to use re.findall()?
The re.findall() helps to get a list of all matching patterns. It searches from start or end of the given string. If we use method findall to search for a pattern in a given string it will return all occurrences of the pattern. While searching a pattern, it is recommended to use re.findall() always, it works like re.search() and re.match() both.
Example
import re result = re.search(r'TP', 'TP Tutorials Point TP') print result.group()
Output
TP
- Related Articles
- How to write a Python Regular Expression to validate numbers?
- 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 write Python regular expression to check alphanumeric characters?
- How to write a Python regular expression to get numbers except decimal?
- How to write a Python regular expression to match multiple words anywhere?
- How to use special characters in Python Regular Expression?
- How to write a case insensitive Python regular expression without re.compile?
- How to write Python regular expression to match with file extension?
- How to write Python Regular Expression find repeating digits in a number?
- How to write a Python regular expression that matches floating point numbers?
- How to write a regular expression to match either a or b in Python?
- How do we use Python regular expression to match a date string?
- How do we use a delimiter to split string in Python regular expression?

Advertisements