Skip to content

Commit 4856b17

Browse files
committed
regex
1 parent 664fdbc commit 4856b17

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

regular expressions/test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@
33
# verify that a string has a proper format (Email, phone)
44
# find a string and replace it with another string
55
# format data into the proper form for importing for example
6+
7+
import re
8+
9+
if re.search("ape.", "The ape was at the apex"):
10+
print("There is an ape")
11+
theStr = "The ape was at the apex"
12+
13+
for i in re.finditer("ape.", theStr):
14+
locTuple = i.span()
15+
print(locTuple)
16+
print(theStr[locTuple[0]: locTuple[1]])

0 commit comments

Comments
 (0)