forked from miczar1/DJFZ-2023
hm2
This commit is contained in:
parent
8b35883eaa
commit
49ac444a19
|
@ -0,0 +1 @@
|
||||||
|
asdasdas9@assd
|
|
@ -0,0 +1 @@
|
||||||
|
False
|
|
@ -1,12 +1,11 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
tekst = """
|
|
||||||
Jan: 12-452
|
|
||||||
Anna: 987 65
|
|
||||||
Karol: 456-78
|
|
||||||
Zbyszek: 53252525342252
|
|
||||||
Tytus: aaaa666432
|
|
||||||
"""
|
|
||||||
|
|
||||||
wzorzec = re.compile(r"\d\d-\d\d\d")
|
fin = open('in.txt', 'r')
|
||||||
print(f'Numery: {wzorzec.findall(tekst)}')
|
fout = open('out.txt', 'w')
|
||||||
|
|
||||||
|
for line in fin.readlines():
|
||||||
|
wzorzec = re.compile(r"\d\d-\d\d\d")
|
||||||
|
if bool(wzorzec.findall(line)):
|
||||||
|
for postcode in wzorzec.findall(line):
|
||||||
|
fout.write(postcode + ' ')
|
|
@ -1,13 +1,11 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
tekst = """
|
|
||||||
Jan: https://regex101.com/
|
|
||||||
Anna: 987 65
|
|
||||||
Karol: 456-78
|
|
||||||
Zbyszek: 53252525342252
|
|
||||||
Tytus: aaaa666432
|
|
||||||
https://git.wmi.amu.edu.pl/
|
|
||||||
"""
|
|
||||||
|
|
||||||
wzorzec = re.compile(r"(https|http):\/\/(www.)?[\d\w]+\.\w+[^.]*")
|
|
||||||
print(f'Numery: {wzorzec.findall(tekst)}')
|
fin = open('in.txt', 'r')
|
||||||
|
fout = open('out.txt', 'w')
|
||||||
|
|
||||||
|
url = fin.readline()
|
||||||
|
|
||||||
|
wzorzec = re.compile(r"^(https?://)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(/\S*)?$")
|
||||||
|
fout.write(str(bool(wzorzec.match(url))))
|
|
@ -1,12 +1,16 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
tekst = """
|
fin = open('in.txt', 'r')
|
||||||
Jan: https://regex101.com/
|
fout = open('out.txt', 'w')
|
||||||
Anna: 987 65
|
|
||||||
Karol: 456-78
|
pesel = fin.readline()
|
||||||
Zbyszek: 12345678901
|
|
||||||
Tytus: aaaa666432
|
if len(pesel) != 11:
|
||||||
"""
|
fout.write('False')
|
||||||
|
exit()
|
||||||
|
|
||||||
wzorzec = re.compile(r"\d{11}")
|
wzorzec = re.compile(r"\d{11}")
|
||||||
print(f'Numery: {wzorzec.findall(tekst)}')
|
|
||||||
|
if wzorzec.match(pesel):
|
||||||
|
fout.write('True')
|
||||||
|
else: fout.write('False')
|
||||||
|
|
|
@ -4,9 +4,15 @@ tekst = """
|
||||||
Jan: https://regex101.com/
|
Jan: https://regex101.com/
|
||||||
Anna: 987 65
|
Anna: 987 65
|
||||||
Karol: 456-78 <\a>
|
Karol: 456-78 <\a>
|
||||||
Zbyszek: 12345678901 <asdasd>
|
<asd> Zbyszek: 12345678901 <asdasd>
|
||||||
Tytus: aaaa666432
|
Tytus: aaaa666432
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
fin = open('in.txt', 'r')
|
||||||
|
fout = open('out.txt', 'w')
|
||||||
|
|
||||||
wzorzec = re.compile(r"<[^>]*>")
|
wzorzec = re.compile(r"<[^>]*>")
|
||||||
print(f'Numery: {wzorzec.findall(tekst)}')
|
|
||||||
|
for line in fin.readlines():
|
||||||
|
for tag in wzorzec.findall(line):
|
||||||
|
fout.write(tag + ' ')
|
|
@ -1,10 +1,12 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
tekst = """
|
fin = open('in.txt', 'r')
|
||||||
asdasdas9@asSd
|
fout = open('out.txt', 'w')
|
||||||
as@d@asjdioajsd7y7asdSa1
|
|
||||||
dioajsd7y7asdSa1
|
password = fin.readline()
|
||||||
"""
|
|
||||||
|
|
||||||
wzorzec = re.compile(r"(?=.*[a-z])(?=.*[A-Z])(?=.*[\d])(?=.*[@#$%&*!]).{8,}")
|
wzorzec = re.compile(r"(?=.*[a-z])(?=.*[A-Z])(?=.*[\d])(?=.*[@#$%&*!]).{8,}")
|
||||||
print(f'{wzorzec.findall(tekst)}')
|
|
||||||
|
if wzorzec.findall(password):
|
||||||
|
fout.write('True')
|
||||||
|
else: fout.write('False')
|
Loading…
Reference in New Issue