Skip to content

Commit 38bbda8

Browse files
committed
update
1 parent 567cc96 commit 38bbda8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

basic/36_RegEx.py

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@
9595
# | : or
9696
print(re.findall(r"(run|ran)", "run ran ren")) # ['run', 'ran']
9797

98+
# re.sub() replace
99+
print(re.sub(r"r[au]ns", "catches", "dog runs to cat")) # dog catches to cat
100+
101+
# re.split()
102+
print(re.split(r"[,;\.]", "a;b,c.d;e")) # ['a', 'b', 'c', 'd', 'e']
103+
98104

99105
# compile
100106
compiled_re = re.compile(r"r[ua]n")

0 commit comments

Comments
 (0)