Skip to content

Commit 505a265

Browse files
Merge pull request #1828 from Kalivarapubindusree/kle
Pattern match with regular expressions Added
2 parents 76ed4e5 + 2332a6c commit 505a265

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Regular_Expressions_Match/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**Regular_Expressions_Match**
2+
3+
4+
5+
**How to Use:**
6+
This Script is an Pattern match with regular expressions before that we need to import re Then just we need to run reg.py simple and easy to use.
7+
8+
9+
**conclusion:**
10+
11+
This Just a Script That we can allow and Deny with our rules! in submmtion formes r webiste whenver we need!
12+
13+
#### 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)