feat: more predefined 'pieces' of regexps
danielroe opened this issue Β· comments
π Your use case
Suggestion
π The solution you'd like
You should add macroability and predefine some macros like http link, xml tag or i don't know maybe uk phone macros etc.
https://twitter.com/senbanabakhele/status/1548715207194824706
More examples:
- US Phone Numbers
- Email Validation
π Alternatives you've considered
No response
βΉοΈ Additional info
No response
@danielroe I have some time this month to contribute, so I plan to work on adding some predefined pieces of regexps.
I'm thinking of the following to start:
- IPv4
- IPv6
- HTTP(S) URLs
- Phone Numbers
- E.164 format
- US
- Basic email validation
- As mentioned in #48 , full validation is quite tricky
Usage
I think usage will look something like this:
import { ipv4 } from 'magic-regex/predefined'
-
@danielroe Any other ideas and a better module name would be greatly appreciated.
-
If anyone else has already started working on this, please let me know so we don't duplicate efforts.
P.S. I figured I'd mention this here: I use Python quite a bit, and I like the API of this package. So if time permits, I might make a python package with a similar API to magic-regex
- obviously without the compile-time type hinting magic π.
That sounds great to me. And let me know when you've got your Python package up so I can link to it...