this post was submitted on 21 Mar 2024
256 points (93.5% liked)

Programmer Humor

31998 readers
947 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 5 months ago (2 children)

I don't know all of the regex rules (look ahead/behind, etc); but it's honestly not that bad. If you can learn the syntax for a programming language, you can learn the basics of regex..

[–] [email protected] -1 points 5 months ago (1 children)

Sure, learning basics of regex is not that hard, but complex regex expressions can easily become impenetrable. I actually like the verbal expressions idea where you write out the regex using a long form and that gets compiled into the actual regex, e.g:

const tester = VerEx()
    .startOfLine()
    .then('http')
    .maybe('s')
    .then('://')
    .maybe('www.')
    .anythingBut(' ')
    .endOfLine();

That seems like the best of both world approach to me.

[–] [email protected] 2 points 5 months ago

My brief experience with LINQ has also taught me to prefer this type of thing as well; though I still use regex on a daily basis most of the time, given my environment.