Skip to content

Vishaljaswal #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion C++/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
1 change: 0 additions & 1 deletion C/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
Binary file added C/hello.c - Shortcut.lnk
Binary file not shown.
1 change: 0 additions & 1 deletion HTML/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
6 changes: 6 additions & 0 deletions HTML/194509.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<title>194509</title>
<body>
Hello World
</body>
</html>
8 changes: 8 additions & 0 deletions HTML/file.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
</head>
<title>Open Source </title>
<body>
Open source software is a free liberal software . It is available with source code and it is easy to distribute.
</body>
</html>
5 changes: 5 additions & 0 deletions HTML/mca.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
<h1>HEY WORLD</h1>
</body>
</html>
1 change: 0 additions & 1 deletion Java/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
1 change: 0 additions & 1 deletion JavaScript/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
1 change: 0 additions & 1 deletion Python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!.gitignore
46 changes: 46 additions & 0 deletions Python/194509.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import re, pyperclip

phoneRegex = re.compile(r'''
(\d{3} | (\(\d{3}\)))?
(\s|-|\.)?
(\d{3})
(\s|-|\.)
(\d{4})
(\s*(ext|x|ext.)\s*(\d{2,5}))?
''',re.VERBOSE)

emailRegex = re.compile(r'''(
[a-zA-Z0-9._%+-]+
@
[a-zA-Z]{2,8}
(\.[a-zA-Z]{2,4})
)''',re.VERBOSE)

text = str(pyperclip.paste())

matches = []

for groups in phoneRegex.findall(text):
if groups[0]!='':
phoneNum = '-'.join([groups[0],groups[3],groups[5]])
else:
phoneNum = '-'.join([groups[3],groups[5]])

if groups[8] != '':
phoneNum += ' x'+groups[8]

matches.append(phoneNum)

for groups in emailRegex.findall(text):
email = groups[0]
matches.append(email)

if len(matches)>0:
pyperclip.copy('\n'.join(matches))
print('coppied to clipboard:')
print('\n'.join(matches))
else:
print('No matches found')
#print(phoneRegex.findall('222-444-5644 234.355.1345 123 234 1231 ext234'))
#print(emailRegex.findall('[email protected]'))
#print(matches)