Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit d87670c

Browse files
committed
Лабораторная №25
1 parent ba3aefe commit d87670c

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23K0120</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23K0120-p25</artifactId>
12+
<description>Regex</description>
13+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package ru.mirea.practice.s23k0120;
2+
3+
public final class Main {
4+
5+
private Main() {
6+
7+
}
8+
9+
public static void main(String[] args) {
10+
System.out.println("Двадцать пятая практическая работа!");
11+
}
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ru.mirea.practice.s23k0120.task4;
2+
3+
import java.util.Scanner;
4+
import java.util.regex.Pattern;
5+
6+
public abstract class Main {
7+
public static void main(String[] args) {
8+
Pattern pattern = Pattern.compile("([a-zA-Z.\\d])+@(([a-z]+\\.[a-z]+)|[a-z]+)");
9+
String input;
10+
try (Scanner scanner = new Scanner(System.in)) {
11+
input = scanner.nextLine();
12+
}
13+
if (pattern.matcher(input).matches()) {
14+
System.out.println("Input string is a valid email address");
15+
}
16+
}
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ru.mirea.practice.s23k0120.task5;
2+
3+
import java.util.Scanner;
4+
import java.util.regex.Pattern;
5+
6+
public abstract class Main {
7+
public static void main(String[] args) {
8+
Pattern patternAll = Pattern.compile("[a-zA-Z\\d_]+");
9+
Pattern patternDigit = Pattern.compile("\\d");
10+
Pattern patternUpper = Pattern.compile("[A-Z]");
11+
Pattern patternLower = Pattern.compile("[a-z]");
12+
String input;
13+
try (Scanner scanner = new Scanner(System.in)) {
14+
input = scanner.nextLine();
15+
}
16+
if (!patternAll.matcher(input).matches()
17+
|| !patternDigit.matcher(input).find()
18+
|| !patternUpper.matcher(input).find()
19+
|| !patternLower.matcher(input).find()) {
20+
System.out.println("Input string is not a secure password");
21+
} else {
22+
System.out.println("Input string is a secure password");
23+
}
24+
}
25+
}

students/23K0120/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
<module>23K0120-p22</module>
3939
<module>23K0120-p23</module>
4040
<module>23K0120-p24</module>
41+
<module>23K0120-p25</module>
4142
</modules>
4243
</project>

0 commit comments

Comments
 (0)