PitchHut logo
Log in / Sign up
readableRegex
by subtle_green_jammie
Transform strings effortlessly with readable regex functions.
Pitch

Readable Regex API simplifies string manipulation by abstracting complex regular expressions. Built on Express.js, it offers endpoints for removing non-numeric and non-letter characters easily. With improved readability and maintainability, this API promotes code reuse and eases testing, making it a valuable tool for developers.

Description

Readable Regex API

The Readable Regex API simplifies string manipulation tasks by providing clear and understandable endpoints for removing non-numeric and non-letter characters from input strings. Built on Express.js, this API encapsulates the intricacies of regular expressions, offering a more accessible way for developers to interact with string data.

Key Features

  • Improved Readability: The API allows developers to perform string manipulations through descriptive function calls instead of cryptic regular expressions. This approach enhances code clarity and comprehension, making it easier for teams to collaborate effectively.

  • Enhanced Maintainability: Updates to the regex logic can be made centrally, minimizing the risk of errors and streamlining maintenance. This ensures consistent functionality across applications without the need to scatter changes throughout the codebase.

  • Increased Reusability: Functions within the API can be reused across different parts of an application or in entirely separate projects, promoting code reuse and reducing redundancy.

  • Simplified Testing: The API’s core functions are designed for straightforward testing, fostering more robust and reliable software development practices.

  • Abstraction Layer: The Readable Regex API abstracts the complexity of regular expressions, freeing developers from needing to understand regex syntax to utilize string manipulation functions effectively.

Usage Example

To interact with the API, clients can send POST requests to specific endpoints. The following example illustrates how to send a request to remove non-numeric characters from a string:

try {
    const response = await fetch("https://readable-regex-8d81b79167bf.herokuapp.com/api/onlyNumbers", {
        method: 'POST',
        body: JSON.stringify({
            inputString: "1234abc"
        }),
        headers: {
            "Content-Type": "application/json"
        }
    });
    const json = await response.json();
    const transformedString = json.result;
    document.querySelector('#responseBox').textContent = transformedString; // Result: 1234
} catch (exception) {
    alert('Error executing regex, try again later! Contact developer for support');
    throw exception;
}

Contribution Guidelines

Developers interested in contributing can follow these steps:

  1. Clone the repository locally.
  2. Create and switch to a new branch based on the main branch.
  3. Test changes with a local server before submitting.
  4. Submit a pull request detailing the changes made and any relevant documentation.

Testing and Quality Assurance

The project utilizes Jest for testing. Writing tests for custom logic is essential to ensure the API functions as intended, with tests organized in dedicated folders for clarity.

Support and Collaboration

For collaboration and support, developers can join the official Readable Regex Slack channel (invite link). This platform fosters communication and enhances project development through shared insights and feedback.

Deployment

The API is deployed on Heroku, facilitating automatic updates whenever changes are merged to the main branch.

The Readable Regex API is a valuable tool for developers seeking a more understandable approach to string manipulation, fostering collaboration and effective coding practices.

0 comments

No comments yet.

Sign in to be the first to comment.