FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/algorithms/strings/pattern_match.py at master · AllAlgorithms/python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Sep 7, 2025. It is now read-only.
AllAlgorithms
/
python
Public archive
Notifications
You must be signed in to change notification settings
Fork
170
Star
385
Code
Issues
1
Pull requests
19
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
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
/
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