Skip to content

Commit 5d7c104

Browse files
Pattern match with regular expressions Added
1 parent 3ce96dd commit 5d7c104

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

Regular_Expressions_Match/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
**Age_Calculator**
2+
3+
4+
5+
**Step1:**
6+
7+
First of all, we need to import two libraries into our code. The first one is the time and date
8+
9+
**Step2:**
10+
11+
Now, just use Age_Calculator.py code run it on online r any complier
12+
13+
**Step3:**
14+
15+
It will frist your date of birth year!
16+
17+
**Step4:**
18+
19+
Then it will ask your birth month!
20+
21+
**Step5:**
22+
23+
Then it will ask your birth day!
24+
25+
**Step6:**
26+
27+
Finally it will just a date of you enterted and current date and time it will print the the years and months days!
28+
29+
**conclusion:**
30+
31+
It is useful to Calculate birthdays in years!
32+
33+
#### By [Kalivarapubindusree]()

Regular_Expressions_Match/reg.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import re
2+
emailRegex = re.compile(r'''(
3+
[a-zA-Z0-9._%+-]+ # username
4+
@ # @ symbol
5+
[a-zA-Z0-9.-]+ # domain name
6+
(\.[a-zA-Z]{2,4}) # dot-something
7+
)''', re.VERBOSE)
8+
9+
# store matched addresses in an array called "matches"
10+
matches = []
11+
text = """
12+
An example text containing an email address, such as [email protected] or something like [email protected]
13+
"""
14+
15+
# search the text and append matched addresses to the "matches" array
16+
for groups in emailRegex.findall(text):
17+
matches.append(groups[0])
18+
19+
20+
print(matches)

0 commit comments

Comments
 (0)