I love RegEx so much

I love RegEx so much.

Regular Expressions appreciation thread

Other urls found in this thread:

github.com/mawww/kakoune/blob/master/src/regex_impl.cc
github.com/mawww/kakoune/blob/master/src/regex_impl.hh
twitter.com/AnonBabble

but does it get "korean pop" though

Regex is legit awesome yes

get a trip so i can filter you OP

.*

ITT: Sup Forums and Sup Forums learn basic technology

post your 4chanx filters
/-$/
one simply regex cleans up 50% of bait

a^n b^n

Do you put a big comment near your regex explaining what it does in plain English? I do for most of them.

/* get all variants of str */ should be obvious enough

good source on learning regex?

What site is that?
Read a fucking manual.

regex is great but you dont need to learn it that's autismo just use guides online / references OP post references you like

I've never used regex to solve real problem. It's useless meme and has massive issues with quoted/escaped strings.

These sites are amazing. I'm a C# dev so I use the latter a lot when doing input validation, etc.

regexr.com
regexhero.net

t. retard

/install Gentoo/

wait untill you find out structural regular expressions

Can someone explain me how to regex
I feel like it's awesome and useful but I barely understand anything and my rules sucks
Usage: Apache and PHP

it's not that useful desu senpai.

it only recognize regular languages which are not that interesting

/>.*/

itt pajeets impressed by regular grammars
wonder what would happen to your brain if you were introduced to cfgs or, god forbid, csg

>my problems are always simple so regex is retarted

I only learned regex so I could use sed more effectively, yet it turns out sed is shit and doesn't even allow me to extract capture groups without a bunch of fuckery that forces me to match the entire line first, even using sed -E.

I once found a really shitty token extraction regex at work and spent like 2 hours building a better one, that would handle edge cases and also things that were obviously meant to be a token but weren't, and a version that allowed escaping tokens and would only match unescaped ones.

It was fun and then only like half of that was actually useful in the end

>can use scanf
>can write lexer/parser state machines
>can use serializable format
you got that wrong, regex is only usable for simplest problems therefor I'm not using it

I love context free grammars

>tfw the majority of cfg lectures are taught by pajeets

Regex is the "fuck it all" Swiss Army knife answer. A nuclear option that you can get working the way you want and not notice the billion ways that it's fucking you over.

Regex is awesome. The primordial fire.

Nah. When you need to get shit done with a bunch of text and have no time for a proper solution, you can always whip up a Frankenstein regex and pipe your data to a util that will handle it.

I just spent a day fiddling with regex at work. It's genius but I fucking hate it. And that's only because I only use it like once a year and I have to re-learn it every time.

Can someone make the regular expression for
"grimes" case insensitive, with op:only? I'm not getting how to do it.

[GRIMESgrimes]+

/grimes/i

easily accepted by a*b*

PCREs are Touring Complete though

>good for simple tasks, stupid for complex patterns
>actually just a regex
>nonsense

[Gg][Rr][Ii][Mm][Ee][Ss]

When you look at pajeet universities, what do you expect
For simple transformations? Yes. For anything that i have to think about, haskell or python. Why spend 5 minutes shitting up a regex that does what you want when you can do it in 4 lines of haskell?

>kpoop

/grimes/i;op:only works for 4chanx.

Why haven't you learned AWK yet, gee?

I just implemented a recursive regular expression engine using Thompson's constructions. The next step is to union the resulting NFA, run it through the powerset construction, then minimize the resulting DFA.

i like that one

>matches trackpad, cockpit and jackpot
noice!

>match something with /pattern/
>captures whole line

If you love regex, check out kakoune, it's a cool text editor with a lot of regex-based primitives. It even has its own implementation of regex in about 2k lines of code (including tests)

github.com/mawww/kakoune/blob/master/src/regex_impl.cc
github.com/mawww/kakoune/blob/master/src/regex_impl.hh

Its syntax is fucking shit, and doesn't even support non-greedy matching.

/(?:-|\.{3})$/

SQL queries

Thoughts on regex escape hell?

Use a language with first class regex support.
or just any decent language with raw strings