- 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 can I use Python regex to split a string by multiple delimiters?
The following code uses Python regex to split the given string by multiple deliimiters
import re s = 'Beautiful; Soup\n is, good: Python* application' result = re.split('; |, |\*|\n|:',s) print result
This gives the output
['Beautiful', 'Soup', ' is', 'good', ' Python', ' application']
- How to split strings on multiple delimiters with Python?
- How we can break a string with multiple delimiters in Python?
- How to Split a String with Escaped Delimiters?
- How can I use Multiple-tuple in Python?
- How do I split a multi-line string into multiple lines?
- How to use Java String.split() method to split a string by dot?
- How to split string by a delimiter str in Python?
- How can I use SUBSTRING_INDEX() function to get the substring as output which is between two same delimiters in a string?
- How we can split Python class into multiple files?
- How do we split a string with any whitespace chars as delimiters using java?
- How to split a string in Python
- How can we split a string by sentence as a delimiter in Java?
- How can I convert bytes to a Python string?
- How can I convert a Python tuple to string?
- How can I set a MySQL database to use MyISAM by default?