Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for high-level predefined patterns like <date> #94

Open
twolodzko opened this issue Jul 18, 2023 · 0 comments
Open

Support for high-level predefined patterns like <date> #94

twolodzko opened this issue Jul 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@twolodzko
Copy link

Imagine that melody had predefined patterns like

  • <date> matching a valid date,
  • <datetime> matching a valid date and time,
  • <float> matches a floating-point number, supporting scientific notation,
  • <unixtime> matches the UNIX timestamp,
  • <url> matches a valid URL,
  • <ip> matches an IP address,
    etc.

In such a case, it would offer not only a clear, easy-to-read, and maintain syntax, but also it would offer to remove a lot of boilerplate code from common expressions.

The hard part is that while for some of those (<unixtime> or <float>), the regexes would be simple, for others, they would not and there are whole StackOverflow threads on which regex is the more correct to match them, so the patterns would obviously be opinionated.

Looking at the code, adding them seems rather straightforward. Alternatively, such patterns could be provided as external libraries, but there is no such functionality.

@twolodzko twolodzko added the enhancement New feature or request label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant