callstack / callstack/ts-regex-builder

[Feature] Common Regex Patterns

Open
#73 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
157
Forks
5
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Provide regex patterns for common use cases like:
- [ ] URL
- [ ] email
- [ ] hashtags
- [ ] hex color

Each pattern should be available in two versions:
- **validator** - the goal of this pattern type is to validate that given string is a valid email, url, etc. This type of pattern should focus on RFC/standards compliance.
- **finder** - the goal of this pattern type is to effectively find given types of patterns (e.g. emails, hashtags, etc) in a longer text. This pattern types aims to be 90% in order to improve efficiency.

**Describe the solution you'd like**
Patterns will be imported through `ts-regex-builder/patterns` import. See #72 for implementation of that part.

Whole library is and should remain tree-shakable, so that unused patterns (and features) are removed by bundlers in order to reduce bundle size.

**Describe alternatives you've considered**
1. Providing pattens in examples/docs - this is an extra step and potentially hard to discover
2. Do nothing - making correct version of certain patterns (e.g. URL) is hard, and we as the library providers can make user life easier here.

**Checklist (for each pattern)**
- [ ] Implementation
- [ ] Tests
- [ ] API docs
- [ ] README docs (if relevant)

CC: @PaulJPhilp

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.