Skip to content

Commit beb713a

Browse files
authored
Create main.py
0 parents  commit beb713a

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

main.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import re
2+
3+
print('''| _ \ ___ __ _ _____ __ / ___| |__ ___ ___| | __
4+
| |_) / _ \/ _` |/ _ \ \/ /____| | | '_ \ / _ \/ __| |/ /
5+
| _ < __/ (_| | __/> <_____| |___| | | | __/ (__| <
6+
|_| \_\___|\__, |\___/_/\_\ \____|_| |_|\___|\___|_|\_\
7+
8+
----m4r0ls------------------
9+
Input:
10+
- quit to exit ;
11+
- help to display help;
12+
- your regex .
13+
''')
14+
txt = open('strings.txt', "r")
15+
16+
run = True
17+
18+
while run:
19+
regex = str(input("Your choice: "))
20+
if regex == 'quit':
21+
print("Goodbye bro")
22+
txt.close()
23+
run = False
24+
elif regex == 'help':
25+
print('''Input your regax with using:
26+
[arn] Returns a match where one of the specified characters (a, r, or n) is present
27+
[a-n] Returns a match for any lower case character, alphabetically between a and n
28+
[^arn] Returns a match for any character EXCEPT a, r, and n
29+
[0123] Returns a match where any of the specified digits (0, 1, 2, or 3) are present
30+
[0-9] Returns a match for any digit between 0 and 9
31+
[0-5][0-9] Returns a match for any two-digit numbers from 00 and 59
32+
[a-zA-Z] Returns a match for any character alphabetically between a and z, lower case OR upper case
33+
[+] In sets, +, *, ., |, (), $,{} has no special meaning, so [+] means: return a match for any + character in the string
34+
\A Returns a match if the specified characters are at the beginning of the string
35+
\b Returns a match where the specified characters are at the beginning or at the end of a word
36+
(the "r" in the beginning is making sure that the string is being treated as a "raw string")
37+
\B Returns a match where the specified characters are present, but NOT at the beginning (or at the end) of a word
38+
(the "r" in the beginning is making sure that the string is being treated as a "raw string")
39+
\d Returns a match where the string contains digits (numbers from 0-9)
40+
\D Returns a match where the string DOES NOT contain digits
41+
\s Returns a match where the string contains a white space character
42+
\S Returns a match where the string DOES NOT contain a white space character
43+
\w Returns a match where the string contains any word characters (characters from a to Z, digits from 0-9, and the underscore _ character)
44+
\W Returns a match where the string DOES NOT contain any word characters
45+
\Z Returns a match if the specified characters are at the end of the string
46+
[] A set of characters
47+
\ Signals a special sequence (can also be used to escape special characters)
48+
. Any character (except newline character)
49+
^ Starts with
50+
$ Ends with
51+
* Zero or more occurrences
52+
+ One or more occurrences
53+
? Zero or one occurrences
54+
{} Exactly the specified number of occurrences
55+
| Either or "falls|stays"
56+
() Capture and group ''')
57+
else:
58+
for word in txt:
59+
if re.search(regex, word):
60+
print(word)
61+
continue
62+

0 commit comments

Comments
 (0)