
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Match Anything Except Space and New Line Using Python Regular Expression
The following code matches anything except space and new line in the given string using regex.
Example
import re print re.match(r'^[^ \n]*$', """IfindTutorialspointuseful""") print re.match(r'^[^ \n]*$', """I find Tutorialspointuseful""") print re.match(r'^[^ \n]*$', """Ifind Tutorialspointuseful""")
Output
This gives the output
<_sre.SRE_Match object at 0x00000000048965E0> None None
Advertisements