Regex general

Can we have some fun with regex?

gets
[code]
(\d)\1+$
[\code]
gets++
[code]
(\d+)\1+$
[\code]

I wrote these to find gets. I have one for the traditional ones like dubs, trips, quads, quints, etc. I also have one expanded for sequences like 123123. The expanded one can't do something like 112233 though. I think 123456 is also a pretty special get. Could we have an expression to get all of these without using OR?

Other urls found in this thread:

ghostbin.com/paste/g6cp5
regexcrossword.com/
noulakaz.net/2007/03/18/a-regular-expression-to-check-for-prime-numbers/
twitter.com/NSFWRedditImage

Dang. I think the slashes in my regex messed up the code format.

...

Real niggers use PEGs or parser combinators not this pleb shit.

in what world would a thread about regex be fun?

Here's the RFC standard for email filtering

\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*
| "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])*")
@ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
| \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:
(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])+)
\])\z

I doubt it fully works. A full RFC 822 regex-based parser is nearly impossible. Everyone that claims to have one winds up failing on some valid input.

this.
even my autism isn't autist enought to find regex funny

^(?=.{4,30}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?

This is supposed to check username (contextual stackoverflow answer in duckduckgo). It fails hard and doesn't allow all alphabets, like öä

I think I got the right one:

fuck you ghostbin.com/paste/g6cp5

...

AFAIK I've seen that one before and it doesn't handle nested comments (legal RFC 822 syntax). Email address parsing is a great example of why regexes are shit for parsing.

It's a highly expressive and specialized language. That's the tradeoff it makes.

The alternative would be having some monster like
startLine(), repeat(any('a','b','c'),0,infinity), endLine() for doing what could be done with ^[abc]*$

[/code], not [\code].
RegEx is really useful, claims by a linux a/s/g user here. Though it looks confusing when it's bloated enough since there's no extra characters allowed in regex, but it can deal nearly any types of text processing.

Oops.

gets
(\d)\1+$
gets++
(\d+)\1+$

I can't believe I made such a shitty OP. I forgot reduce my image size too.

Since you guys like regex so much, I might come back later with some finite automata, and we can practice translating them to grammars and regex. I can't right now though.

Oh, I'm not saying I don't like it.
It's just blowing my mind.
I didn't know something like this even existed until this thread.

fun way to learn regex
regexcrossword.com/
or you could try regex golf but it's a bit shit

Actually, that looks pretty nice. It would be cool to have a program that can generate a regex from a more human-readable language. I think LISP S-expressions would work pretty well for this. Well, now I have an idea for what to do when I'm further into SICP.

I tried making a regex generator for normies, but it's more difficult that I expected.

What are grok patterns?

Fun challenge: Make an XML parser in Regex.

10 / 10
would do again

Best regex meme.

Also ITT: kripplecice fix ur shit

Nice snipe hunt. The reason why regular expressions can't parse XML is in the name. I've worked on a pushdown automata for parsing JSON and XML before.

regex is mental
noulakaz.net/2007/03/18/a-regular-expression-to-check-for-prime-numbers/