GitHub - yoav-lavi/melody: Melody is a language that compiles to regular expressions and aims to be more easily readable and maintainable
github.com
external-link
Melody is a language that compiles to regular expressions and aims to be more easily readable and maintainable - GitHub - yoav-lavi/melody: Melody is a language that compiles to regular expressions...

so, where’s the email address regex? that’s where this lives or dies. there is no reason to use this for extremely simple happy-path regexes.

i’m having a tough time understanding who this is for. a beginner might think this is great, but they’re shooting themselves in the foot by adding an additional layer of abstraction rather than reading something to learn the basics.

I am of the opinion that regex for email address is a bad idea. The only two things that you need to check an email address are:

Does the address contain an @ symbol?
Is there a dot to the right of the @ symbol?

Then just try to deliver to it, and let the MTA do the rest.

Email addresses can be complicated, and there’s plenty of valid addresses that can be excluded by attempts at regex validation.

@custom_situation @yoavlavi

If it can do that, i might just use it. It’ll make code a whole lot cleaner to read.

I agree. In fact, the only check is if it contains the @ symbol, since “com” and other TLDs/gTLDs can have MX records, it is possible to have email@com. Not that we’d ever see it in practice though.

@Zikeji It’s possible for TLDs to have A records, and for a while there were a few that did. But ICANN forbids top level A records, and I wouldn’t be surprised if they forbid top level MX records as well.

Anyway, you would literally enter the address as “email@com.” including the trailing dot, which represents the DNS root that contains all the TLDs. You can also think of the trailing dot as an indicator of a FQDN (instead of a hostname within your local search domain).

i said “email” but what i meant was “show me a complicated example”. i don’t disagree with anything you said.

@Kempeth@feddit.de
link
fedilink
English
11Y

I disagree. Anyone familiar with regex can debug these statements post conversion. Anyone not familiar with regex is going to have to learn something in order to debug the statement. I’d rather learn something that’s expressive and easy to visually parse.

regex syntax is a vestige of the old “as few bytes as possible” era where every character of code had to be written personally. It’s an obsolete way of thinking for the vast majority of programming.

Create a post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog