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

<answer>

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

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

@NateNate60@lemmy.world
creator
link
fedilink
34M

They said—

A line with exactly 0 or 1 characters, or a line with a sequence of 1 or 3 or more characters, repeated at least twice

Note—

…or a line with a sequence of 1 or 3 or more characters, repeated at least twice

It should be—

…or a line with a sequence of 2 or more characters, repeated at least twice

The regex in the post will match “abab”. Their original description (line 2 of this comment) will not match “abab”.

I agree, you’re right about the part after the pipe and RegalPotoo’s explanation was not entirely correct.

Create a 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.
  • 1 user online
  • 18 users / day
  • 117 users / week
  • 455 users / month
  • 2.2K users / 6 months
  • 1 subscriber
  • 1.69K Posts
  • 37.2K Comments
  • Modlog