https://github.com/zipcodecore/regex-hamlet-parser
Regex: Hamlet Parser
https://github.com/zipcodecore/regex-hamlet-parser
Last synced: 9 months ago
JSON representation
Regex: Hamlet Parser
- Host: GitHub
- URL: https://github.com/zipcodecore/regex-hamlet-parser
- Owner: ZipCodeCore
- Created: 2019-03-12T20:34:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T20:42:59.000Z (about 2 years ago)
- Last Synced: 2025-04-15T21:15:32.067Z (9 months ago)
- Language: Java
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 42
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.