Skip to content

A carefully curated collection of regex patterns designed for easy copying and use in validating various data formats. Ideal for developers and data analysts looking to streamline their validation processes.

License

Notifications You must be signed in to change notification settings

nicholasadamou/coolregex

Repository files navigation

coolregex.fyi

Vercel Next JS TypeScript PNPM MIT License

coolregex.fyi

Welcome to coolregex.fyi, a powerful tool for working with regular expressions, built using Next.js. This project was bootstrapped with create-next-app.

📖 Read the full case study on my website nicholasadamou.com/projects/coolregex.

Table of Contents

Getting Started

To get a local copy up and running, follow these steps.

Prerequisites

Make sure you have Node.js and npm (or yarn, pnpm, bun) installed on your machine.

Installation

  1. Clone the repository:

    git clone https://github.com/nicholasadamou/coolregex.git
    cd coolregex
  2. Install dependencies:

    npm install
    # or
    yarn install
    # or
    pnpm install
    # or
    bun install

Development

Running the Development Server

Start the development server with the following command:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 in your browser to view the application.

You can start editing the page by modifying app/page.tsx. The page will auto-update as you edit the file.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Features

  • Regex Testing: Easily test and debug regular expressions.
  • Real-time Updates: See changes in real-time as you edit your regex.
  • Custom Fonts: Optimized loading of Google Fonts for better performance.
  • Syntax Highlighting: Colorful highlighting of regex components for better readability.
  • Command Bar: Quick search and navigation through regex patterns.

Architecture

Component Hierarchy

graph TD
    A[app/page.tsx] --> B[CommandBar]
    A --> C[RegexCard]
    C --> D[RegexHighlighter]
    C --> E[TestSection]
    C --> F[CardHeader]
    B --> G[CommandDialog/UI]
Loading

Data Flow

flowchart LR
    A[User Input] --> B[CommandBar]
    B -- search term --> C[app/page.tsx]
    C -- filtered regex --> D[RegexCard]
    D -- regex pattern --> E[RegexHighlighter]
    D -- regex pattern --> F[TestSection]
    F -- test results --> D
Loading

Component Interaction

sequenceDiagram
    participant User
    participant CommandBar
    participant Page as app/page.tsx
    participant RegexCard
    participant RegexHighlighter

    User->>CommandBar: Search for regex (⌘K)
    CommandBar->>Page: Update search term
    Page->>RegexCard: Filter and render cards
    RegexCard->>RegexHighlighter: Render highlighted regex
    User->>RegexCard: Click test button
    RegexCard->>RegexCard: Toggle test section
    User->>RegexCard: Enter test string
    RegexCard->>RegexCard: Validate against regex
    RegexCard->>User: Show match result
Loading

Core Components

RegexHighlighter

The RegexHighlighter component provides syntax highlighting for regular expressions, making them easier to read and understand. It parses the regex string and applies different styles to different parts of the regex (character classes, quantifiers, groups, etc.).

CommandBar

The CommandBar component provides a searchable interface for finding specific regex patterns. It can be activated with keyboard shortcuts (⌘K) and filters the available regex patterns based on user input.

RegexCard

The RegexCard component displays a regex pattern with its title, description, and provides functionality to test the regex against a user-provided string. It also allows copying the regex to the clipboard.

Learn More

To learn more about Next.js, check out the following resources:

You can also visit the Next.js GitHub repository for more information and to contribute feedback or code.

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

License

Distributed under the MIT License. See LICENSE for more information.

About

A carefully curated collection of regex patterns designed for easy copying and use in validating various data formats. Ideal for developers and data analysts looking to streamline their validation processes.

Resources

License

Stars

Watchers

Forks