question has to do with Java programing. I am attempting to do a Regex Lab and read in a text file and validate whether or not it is license plate. The problem is that the text file is read and one of the examples is "ABC 1234", but it reads "ABC" instead of the whole line. I will attach the screenshots of what I have so fa
question has to do with Java programing. I am attempting to do a Regex Lab and read in a text file and validate whether or not it is license plate. The problem is that the text file is read and one of the examples is "ABC 1234", but it reads "ABC" instead of the whole line. I will attach the screenshots of what I have so fa
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
My question has to do with Java

Transcribed Image Text:File Edit View Build Project Settings Tools Window Help
В
All Files
Sort B...
1 АВС 1234
2 HJ3 350P
3 ) (4 POkj
4 490nnIOK
/Object Oriented Pro
5 86R TLM9
BigIntBigDecimalLab.
J BigIntBigDecimalLab.
BiglntegerBig Decima
ClassRelationshipLab
J ClassRelationshipLab
6 tYU 97M
7 QAU IFB
8 pI9 3fX
9 ZI7 D60
10 L82 HWC
Clock.class
Clock.java
idbb.txt
regexlab.txt
StringBuilderLab.clas
J StringBuilderLab.java
StringRegexLab.class
U StringRegexLab.java
Time.class
Time.java
J WrapperClassesExam
G
CSD
G
CSD
G
CSD
G
G
G
|G
G
G
CSD
G
G
CSD
G
CSD
G
G
G
G
G
G
CSD
G
|G
G
G
G
G
G
CSD
G
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
Compile Messages JGRASP Messages
Run I/0
Interactions
The proposed license plate is ) ( 4.
This is not a valid license plate.
The proposed license plate is POkj.
This is not a valid license plate.
The proposed license plate is 490nnIOK.
This is not a valid license plate.
End
Clear
Help
Browse
Find
Debug Workbench
Line:1
Col:1
Code:65
Top:1
ovs BLK
![File Edit View Build Project Settings Tools Window Help
В
All Files
Sort B...
{
list[i] = list[i].replaceAll("\\s", "");
System.out.println(list[i]);
}
61
62
|/Object Oriented Pro
65
BigIntBig DecimalLab.
O BigIntBigDecimalLab.
O BiglntegerBigDecima
ClassRelationshipLab
J ClassRelationshipLab
66
67
File myFile
Scanner in
new File("regexlab.txt"); // Declares a variable of type File
new Scanner(myFile);
68
69
70
String lp = " ";
Clock.class
71
while (in.hasNext())
{
72
Clock.java
73
idbb.txt
74
= in.next();
regexlab.txt
StringBuilderLab.clas
U StringBuilderLab.java
StringRegexLab.class
U StringRegexLab.java
lp
System.out.println("The proposed license plate is
if(lp.matches ("[A-Z0-9]{3} [A-Z0-9]{4}"))
{
System.out.println("This is a valid license plate.");
}
else
75
+ lp +
') ;
76
77
78
79
Time.class
81
System.out.println("This is not a valid license plate.");
Time.java
J WrapperClassesExam
}// close while loop
in.close() ;
82
83
84
}// end of main
86 }// end of StringRegexLab
85
G
CSD
G
CSD
G
G
CSD
G
G
CSD
G
CSD
G
CSD
G
CSD
G
G
G
G
CSD
G
G
CSD
G
G
G
G
G
G
G
G
G
CSD
G
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
Compile Messages JGRASP Messages
Run I/0
Interactions
The proposed license plate is ) ( 4.
This is not a valid license plate.
The proposed license plate is POkj.
This is not a valid license plate.
The proposed license plate is 490nnIOK.
This is not a valid license plate.
End
Clear
Help
Browse
Find
Debug Workbench
Line:76
Col:41 Code:65
Top:61
ovS BLK
RI
4 5 6
00 00 00 O 00 OO 0
666 66](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4a72b2a6-8d02-4587-b866-951b6cc6936d%2F42c354d8-726a-4c53-852b-8d002cbaac16%2F7h5zykm_processed.png&w=3840&q=75)
Transcribed Image Text:File Edit View Build Project Settings Tools Window Help
В
All Files
Sort B...
{
list[i] = list[i].replaceAll("\\s", "");
System.out.println(list[i]);
}
61
62
|/Object Oriented Pro
65
BigIntBig DecimalLab.
O BigIntBigDecimalLab.
O BiglntegerBigDecima
ClassRelationshipLab
J ClassRelationshipLab
66
67
File myFile
Scanner in
new File("regexlab.txt"); // Declares a variable of type File
new Scanner(myFile);
68
69
70
String lp = " ";
Clock.class
71
while (in.hasNext())
{
72
Clock.java
73
idbb.txt
74
= in.next();
regexlab.txt
StringBuilderLab.clas
U StringBuilderLab.java
StringRegexLab.class
U StringRegexLab.java
lp
System.out.println("The proposed license plate is
if(lp.matches ("[A-Z0-9]{3} [A-Z0-9]{4}"))
{
System.out.println("This is a valid license plate.");
}
else
75
+ lp +
') ;
76
77
78
79
Time.class
81
System.out.println("This is not a valid license plate.");
Time.java
J WrapperClassesExam
}// close while loop
in.close() ;
82
83
84
}// end of main
86 }// end of StringRegexLab
85
G
CSD
G
CSD
G
G
CSD
G
G
CSD
G
CSD
G
CSD
G
CSD
G
G
G
G
CSD
G
G
CSD
G
G
G
G
G
G
G
G
G
CSD
G
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
CSD
Compile Messages JGRASP Messages
Run I/0
Interactions
The proposed license plate is ) ( 4.
This is not a valid license plate.
The proposed license plate is POkj.
This is not a valid license plate.
The proposed license plate is 490nnIOK.
This is not a valid license plate.
End
Clear
Help
Browse
Find
Debug Workbench
Line:76
Col:41 Code:65
Top:61
ovS BLK
RI
4 5 6
00 00 00 O 00 OO 0
666 66
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education