- 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 split on successions of newline characters using Python regular expression?
The following code splits on successions of newline characters in the following string using Python regex
Example
import re s = """I find Tutorialspoint useful""" print re.split(r"[\n]", s)
Output
This gives the output
['I find', ' Tutorialspoint', ' useful']
- Related Articles
- How to match tab and newline but not space using Python regular expression?
- How to match nonword characters in Python using Regular Expression?
- How to Split String in Java using Regular Expression?
- How to use special characters in Python Regular Expression?
- How to write Python regular expression to check alphanumeric characters?
- Java Program to split a string using Regular Expression
- How do we use a delimiter to split string in Python regular expression?
- How to print all the characters of a string using regular expression in Java?
- How to match a word in python using Regular Expression?
- How to match a whitespace in python using Regular Expression?
- How to match only digits in Python using Regular Expression?
- How to extract numbers from text using Python regular expression?
- How to extract date from text using Python regular expression?
- How to strip spaces/tabs/newlines using Python regular expression?
- How to remove tabs and newlines using Python regular expression?

Advertisements