Question
Need help! Create a Java program that will accept a regular expression and a filename for a text file. The program will process the file,
Need help!
Create a Java program that will accept a regular expression and a filename for a text file. The program will process the file, looking at every line to find matches for the regular expression and display them.
The output from your program should be formatted like this:
Match found on line 10, starting at position 10 and ending at position 25: aaaaaaaaaaaaaa0
If the regular expression entered was a*[01]
And the input file contained at line 10:
Xxdsdsasdaaaaaaaaaaaaaaa0
Your program must implement its own regular expression functionality you can not use the built-in regular expression mechanism, nor can you include one from a package or JAR file unless you created it.
The following operators are required to be accepted:
+ - one or more of the following character (no groups)
* - zero or more of the following character (no groups)
[] no negation, no character spans the only format is explicit, for example [0123456789]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started