Skip to content

ZipCodeCore/Regex-Hamlet-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Regular Expressions Lab - Hamlet Parser

Instructions:

In this project, your task is to create a Java program that processes the provided "Hamlet" text file using regular expressions. The goal is to replace every occurrence of "Hamlet" with "Leon" and every occurrence of "Horatio" with "Tariq." This process should be achieved exclusively using the Pattern and Matcher classes, without relying on String Utilities for direct word replacement.

Step 1: Set Up the Project

Begin by forking this repository and submit the URL of your fork via the Student Portal.

Step 2: Write Test Cases

Start by writing test cases that will guide the development of your program. You are responsible for creating all the necessary tests to ensure the correctness and robustness of your solution. Some stubs for test cases have been provided, but you should expand upon these to cover various scenarios.

Step 3: Implement the Text Replacement Logic

In this step, you will create methods to process the input text file using regular expressions. The main objective is to find and replace the target words "Hamlet" and "Horatio" with "Leon" and "Tariq," respectively. Ensure that your implementation uses the Pattern and Matcher classes to perform these replacements.

Step 4: Handle File Input and Output

Develop methods to read the "Hamlet" text file and save the modified content back to a new file. Consider error handling and file I/O operations to make your program robust.

Step 5: Test Your Implementation

Execute the test cases you created in Step 2 to validate your solution. Ensure that the replacements are accurate, and the program handles different scenarios effectively.

Step 6: Optimize and Refactor

Review your code for any potential optimizations or improvements. Consider factors such as code readability, performance, and maintainability.

Step 7:Final Checks

Double-check your project to ensure it meets all the requirements and provides accurate text replacement.

Step 8: Submission

Commit and push to your fork.

Releases

No releases published

Packages

No packages published

Languages