Create a java program that will accept a regular expression

Assignment Help JAVA Programming
Reference no: EM131876630

Assignment: Regular Expression processor in Java

Overview: 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.

Regular Expression Format

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]

Output:

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

Restrictions

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 and included the source code in your submission

Testing

Be sure to test your code thoroughly - it will be graded using regular expressions and files that you do not have access to. Your code must work for all regular expressions and text files as described above. While you MAY NOT share code in any way, I would encourage all of you to write tests and share them with each other. You can write and test your test cases against sites like : https://regex101.com/ or using Unix/Mac grep

Some Design Hints

Break this down into two problems:

1) Build a list of states from the regular expression
2) Loop over the input lines, then over each character in each input line, checking the input against the states.

I built a class to wrap String, adding the idea of which character is "current" and the ability to get the current character and to peek at the next character. This made my code cleaner and easier to reason about.

Reference no: EM131876630

Questions Cloud

Create a network security vulnerability and threat table : Create a network security vulnerability and threat table in which you outline the security architecture of organization and cryptographic means of protecting.
What is the total vehicle delay in veh-min : A new computer system is put in place at a toll booth. Assuming D/D/1 queuing, what is the total vehicle delay in veh-min?
Describe the statute in terms of all possible classification : A new state law mandates that all employers must prohibit smoking on employer premises.
What is the network diagram : What is the network diagram? Calculate the slack for each activity. Which activites are on the critical path?
Create a java program that will accept a regular expression : Create a Java program that will accept a regular expression and a filename for a text file. The program will process file, looking at every line to find matche.
Design four unique systems design diagrams from your class : Design four unique systems design diagrams from your class project for peer review. Include an old design and new design using class and architecture diagrams.
Provide basic information on industry-target market growth : Provide basic information on industry/target market growth and trends concerning your target consumer and the associated market.
Discuss your impressions of this mission statement : The founder' mission statement is about inspiring her employees to do their best on a daily basis. The mission statement also has religious references.
What does the given code segment output : What does the following code segment output? How many times will the following for-statement execute when solution is executed with the following command line?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd