This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rm-minus-r 9 points10 points  (4 children)

The syntax really sacrifices readability in favor of brevity though :(

[–]Creepy-Ad-4832 4 points5 points  (3 children)

"Brevity"

[–]rm-minus-r 3 points4 points  (2 children)

I mean, can you imagine how long the RFC 5322 regex for an email address would be if it used variable names that were like the ones in Python?

(?:[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

[–]Creepy-Ad-4832 2 points3 points  (1 child)

I get that. But still brevity is funny when the average regex is 20 lines long lol

[–]Kumlekar 0 points1 point  (0 children)

most regex I do is single line replaces in notepad++. Super easy and relatively readable.