- 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 match whitespace but not newlines using Python regular expressions?
The following code matches only the whitespaces but not newlines in the given string
Example
import re print re.findall(r"(\s){1,}","""I find Tutorialspoint useful""")
Output
This gives the output
[' ', ' ', ' ']
- Related Articles
- How to match whitespace in python using regular expressions
- How to match a whitespace in python using Regular Expression?
- How to match tab and newline but not space using Python regular expression?
- How to strip spaces/tabs/newlines using Python regular expression?
- How to remove tabs and newlines using Python regular expression?
- Finding a Match Within Another Match Java regular expressions
- How to match a word in python using Regular Expression?
- How to match nonword characters in Python using Regular Expression?
- How to match only digits in Python using Regular Expression?
- MySQL Regular expressions: How to match digits in the string with d?
- How to match a nonwhitespace character in python using Regular Expression?
- How to match only non-digits in Python using Regular Expression?
- How to match a single character in python using Regular Expression?
- How do i match just spaces and newlines with Python regex?
- How to match any one lowercase vowel in python using Regular Expression?

Advertisements