Empty input Or input of exactly 1 character Or input of at least 2 characters, followed by at least 1 something (idk what \1 matches)
Did I get it (almost)?
Post funny things about programming here! (Or just rant about your favourite programming language.)
Empty input Or input of exactly 1 character Or input of at least 2 characters, followed by at least 1 something (idk what \1 matches)
Did I get it (almost)?
\1 is group 1 which is inside ()
, so second part is repeated 2 or more times of 2 or more char.
Interesting.
So that means match any string that is made entirely of a single repeating sequence, where repititon is possible.
I could be wrong but I think the (..+?)
portion will either remove a dud or replenish the allowance.
For a second I thought I was still in the thread about monkeys face-rolling typewriters until the heat death of the universe not eventually producing Hamlet
The pipe is throwing me off because usually I have to do parentheses for that to work...
It matches for non-primes and doesn't match for primes.
I'm I the only one who pronounces regex with a soft g? Hard g feels so clunky
All my homies hate regexs. That's actually the best use case I found for LLMs so far : I just tell it what I want it to match or not match, and it usually spits out a decent one