Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # re_split.py
- import re
- def findall_lossless(text):
- result = re.findall(r'\b\w+\b|\s+|[^\w\s]+', text)
- return result
- method = "Hello, world! This is a test-case."
- result = findall_lossless(method)
- for z in result:
- print([z])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement