this post was submitted on 16 Jul 2023
4 points (100.0% liked)

Programming

17129 readers
314 users here now

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



founded 1 year ago
MODERATORS
all 13 comments
sorted by: hot top controversial new old
[–] vrighter@discuss.tchncs.de 1 points 1 year ago

oh god no, that's an even bigger abomination than regex themselves

[–] Kempeth@feddit.de 1 points 1 year ago

I am very much in the market for a way to do regex without resorting to incantations that look like someone spilled a bag of special characters. Just not on JS...

You seem to be the author. A suggestion to you. You should really rethink your playground. All it currently does is turning melody into regex, which is important to have for comparison. But you're specifically courting people who DON'T want to deal with regex syntax. What you desperately need is a way to run melody expressions. And - if possible - a way to translate regex into melody wouldn't hurt as well.

Many (most?) of us tend to google regex on the web and pasting them in our code. Having them converted into a syntax that we can better understand would be hugely helpful.

[–] custom_situation@lemm.ee 0 points 1 year ago (1 children)

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.

[–] TerrorBite@meow.social 0 points 1 year ago (1 children)

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

[–] custom_situation@lemm.ee 1 points 1 year ago

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

[–] Pleonasm@programming.dev 0 points 1 year ago (1 children)

Who is this for? People who write lots of regular expressions won't need it because they know what they're doing and people who don't write lots of regular expressions probably won't find it anyway.

It just seems like a weird type of user who actually wants this.

[–] realitista@lemm.ee 2 points 1 year ago* (last edited 1 year ago) (1 children)

I almost never use regex, but when I do, I'd love something like this. Exactly because I don't use regex enough to be bothered learning it's impenetrable syntax.

[–] NightAuthor@beehaw.org 0 points 1 year ago (1 children)

I learned enough to see how powerful it was, then started using it within Sublime Text to edit data from time to time. (Extract URLs or something from a websites code, reformat X or Y data for a script I’m hacking together) and I’ve slowly retained more and more of the elements I repeatedly use. I think I’ve actually got a pretty good grasp on it. Maybe you should be using it more.

[–] Kempeth@feddit.de -1 points 1 year ago

When you want to get better using a hammer, just treat everything as a nail.

[–] janWilejan@kbin.social -1 points 1 year ago (2 children)

Oh great. A new flavour of regex, but it's less portable and more verbose. https://xkcd.com/927/

[–] yoavlavi@programming.dev 1 points 1 year ago* (last edited 1 year ago)

I wouldn't consider Melody a new flavour of regex as it compiles to ECMAScript regular expressions.

I'd consider being more verbose than regular expressions as a great thing for what this project aims to do, regular expressions are very write optimized which is the wrong (IMO) tradeoff to make in a shared codebase (or even your personal code that's more than a few days old) where code is read much more often.

[–] Kempeth@feddit.de 1 points 1 year ago

but it’s less portable and more verbose

you misspelled "less obtuse and more expressive"

Also it doesn't compete with regex. It's an abstraction layer. You know, the thing programmers have been building since the dawn of programming to make everyone's lives easier. There's a reason why everyone who has the option to has stopped working directly with assembly and C.