- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 Python regular expression to get zero or more occurrences within the pattern?
* An asterisk meta-character in a regular expression indicates 0 or more occurrences of the pattern to its left
The following code matches and prints the zero or more occurrences of the pattern '\w' in the string 'chihua huahua'
import re s = 'chihua huahua' result = re.findall(r'\w*', s) print result
This gives the output
['chihua', '', 'huahua', '']
- How to write a Python regular expression to get numbers except decimal?
- How to write Python regular expression to get all the anchor tags in a webpage?
- How to write a regular expression to match either a or b 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 write Python regular expression to check alphanumeric characters?
- How to write Python regular expression to match with file extension?
- Program to check regular expression pattern is matching with string or not in Python
- How to use regular expression in Java to pattern match?
- How to write a case insensitive Python regular expression without re.compile?
- How to write a Python regular expression to match multiple words anywhere?
- Lua pattern matching vs regular expression