FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-3/algorithms/strings/pattern_match.py at master · iCodeIN/python-3 · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
iCodeIN
/
python-3
Public
forked from
AllAlgorithms/python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-3
/
algorithms
/
strings
/
pattern_match.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (18 loc) · 597 Bytes
Breadcrumbs
python-3
/
algorithms
/
strings
/
pattern_match.py
Copy path
File metadata and controls
24 lines (18 loc) · 597 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# A Python program to demonstrate working
# of re.match().
import
re
# a sample function that uses regular expressions
# to find month and day of a date.
def
findMonthAndDate
(
string
):
regex
=
r"([a-zA-Z]+) (\d+)"
match
=
re
.
match
(
regex
,
string
)
if
match
==
None
:
print
"Not a valid date"
return
print
"Given Data: %s"
%
(
match
.
group
())
print
"Month: %s"
%
(
match
.
group
(
1
))
print
"Day: %s"
%
(
match
.
group
(
2
))
# Driver Code
findMonthAndDate
(
""
#Enter pattern to match)
print
(
""
)
findMonthAndDate
(
""
)
#Enter string
Back
|
FazBrowse Home
|
New Git URL