^.?$|^(..+?)\1+$

<answer>

Matches strings of any character repeated a non-prime number of times

https://www.youtube.com/watch?v=5vbk0TwkokM

You are viewing a single thread.
View all comments View context
6 points

Regex should generally be avoided wherever possible.

permalink
report
parent
reply
13 points

Yeah but it’s just so tempting… It validates so many inputs so easily…

permalink
report
parent
reply
12 points

And misses others you didn’t think about.

permalink
report
parent
reply
6 points

Yeah, I’ve found myself wasting quite a lot of time thinking of the ‘perfect regex’ for task X only to realise that I could have avoided doing so by simply taking a different approach.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 5.4K

    Monthly active users

  • 888

    Posts

  • 9K

    Comments

Community moderators