Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 3, 2025

Add 'Fix Pattern' button to Regex Tester

Summary

Adds a "Fix Pattern" button to the Regex Tester utility that generates a regex pattern matching the test string by escaping special regex characters. When clicked, the button takes the current test string and creates a properly escaped regex pattern that will match it literally.

Changes:

  • Added escapeRegexPattern utility function that escapes special regex characters (.*+?^${}()|[\]\\)
  • Added "Fix Pattern" button below the Regex Pattern textarea (disabled when test string is empty)
  • Added unit tests for the new escape function

Review & Testing Checklist for Human

  • Verify the "Fix Pattern" behavior matches expectations - The button escapes the test string to create a literal match pattern. Confirm this is the intended behavior from the bug report (the Jam video mentioned wanting a button to "fix the regex pattern to match the test string")
  • Test the button with special characters - Try test strings like hello.world, (test), a*b+c? and verify the generated pattern correctly matches
  • Test the button is disabled when test string is empty - The button should be disabled until a test string is entered

Recommended test plan:

  1. Go to /utilities/regex-tester
  2. Enter a test string like hello.world
  3. Click "Fix Pattern" - should populate pattern with hello\.world
  4. Verify the result shows "Match found: 1 match"

Notes

- Add escapeRegexPattern utility function to escape special regex characters
- Add 'Fix Pattern' button that generates a regex pattern matching the test string
- Add tests for the new escapeRegexPattern function

Fixes: Regex Tester missing button to fix pattern
Co-Authored-By: dani@jam.dev <ddanigrant@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@cloudflare-workers-and-pages
Copy link

Deploying jam-dev-utilities with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ebbd1e
Status: ✅  Deploy successful!
Preview URL: https://fc669720.jam-dev-utilities.pages.dev
Branch Preview URL: https://devin-1764771420-add-fix-pat.jam-dev-utilities.pages.dev

View logs

@danigrant danigrant closed this Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants