This repository was archived by the owner on Dec 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +68
-0
lines changed
src/main/java/ru/mirea/practice/s23k0120 Expand file tree Collapse file tree 5 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 3838 <module >23K0120-p22</module >
3939 <module >23K0120-p23</module >
4040 <module >23K0120-p24</module >
41+ <module >23K0120-p25</module >
4142 </modules >
4243</project >
You can’t perform that action at this time.
0 commit comments