jamdotdev / jam-dev-utilities

Lightweight utils set - fast and open-source. It's got cmd+k search & everything's client-side. No ads, your data stays local.
https://jam.dev/utilities
GNU General Public License v3.0
193 stars 19 forks source link

feat: regex tester #38

Closed shashankshet closed 1 month ago

shashankshet commented 1 month ago

Hi Team,

I've added a new regex testing feature that lets users input a regex pattern and a test string to see if they match. It includes error handling for invalid patterns.

If you find this feature useful, please consider merging it into the main branch.

Thanks!

danigrant commented 1 month ago

That's such an awesome tool to add!! Thank you so much @shashankshet!

Would love to send you a swag thanks :) if you send me an email (dani@jam.dev) I'll get your mailing details and send something over! 😃

shashankshet commented 1 month ago

Thanks! @danigrant I’m glad you liked the tool. I appreciate the offer and will send you an email with my mailing details right away.

peckz commented 1 month ago

@shashankshet Thank you for the initiative, it's an amazing idea! Once you implement suggested changes, I'm going to design component that will highlight matched characters, similar to https://regexr.com/. Once that's done, we will be ready to ship this tool!

shashankshet commented 1 month ago

Hi @peckz,

I've addressed the review comments:

  1. Refactored the handleTest function to use the new createRegex() function, allowing full regex patterns with flags. This also improves error handling and messaging.
  2. Updated the placeholder text to be more specific, showing an example regex pattern.
  3. Additionally, I enhanced the UI by displaying the match status ("Match found" or "No match found") next to the "Result" label. The status is now color-coded, with "Match found" appearing in green and "No match found" in red for better visual feedback.

Let me know if there's anything else!

peckz commented 1 month ago

@shashankshet Thank you! It's my turn, stay tuned!

peckz commented 1 month ago

@shashankshet Thanks for the great idea and initial setup! I added text highlighter and set of tests to cover createRegex(). Welcome to the contributors list!