Regex general

Can we have some fun with regex?


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:

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

| "(?:[\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}
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])+)

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.

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


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


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.



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
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