The following matches and prints just spaces and newlines in the given string using Python regex
Example
import re foo = ' I find Tutorialspoint useful' result = re.findall(r'\s+', foo) print result
Output
This gives the output
[' ', ' ', ' \n ', ' \n ']