Is there a reason to use (..+?)
instead of (.+)
?
Programmer Humor
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.
It matches “yo momma”.
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.
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