summaryrefslogtreecommitdiff
path: root/regex_test.py~
diff options
context:
space:
mode:
Diffstat (limited to 'regex_test.py~')
-rw-r--r--regex_test.py~12
1 files changed, 12 insertions, 0 deletions
diff --git a/regex_test.py~ b/regex_test.py~
new file mode 100644
index 0000000..4468629
--- /dev/null
+++ b/regex_test.py~
@@ -0,0 +1,12 @@
+import re
+
+# multiline string
+string = 'abc 12\
+de 23 \n f45 6'
+
+# matches all whitespace characters
+pattern = '\s+'
+replace = ''
+
+new_string = re.sub(r'\s+', replace, string, 1)
+print(new_string)