Destroyed By A Regex

  Рет қаралды 90,218

ThePrimeTime

ThePrimeTime

3 ай бұрын

Recorded live on twitch, GET IN
/ theprimeagen
Become a backend engineer. Its my favorite site
boot.dev/?promo=PRIMEYT
This is also the best way to support me is to support yourself becoming a better backend engineer.
Blog article: osintteam.blog/the-cloudflare...
By: Aditya Armal
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact
Kinesis Advantage 360: bit.ly/Prime-Kinesis
Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
turso.tech/deeznuts

Пікірлер: 419
@DMSBrian24
@DMSBrian24 3 ай бұрын
>junior asks chatGPT for parsing a string and blindly copies a 2 line-long regex >"damn this junior seems to know his shit, i have to act like i understand it" >"LGTM"
@anonymousanon4822
@anonymousanon4822 3 ай бұрын
Jokes aside, the one thing that really impresses me about ChatGPt when it comes to coding are its RegEx capabilities. I once needed a Lua Pattern (less capable version of RegEx without assertions or repeating words) to extract quoted parts from a string with the limitation that escaped quotes need to be ignored. It came up with a three step process where it first replaces every instance of escaped quotes in the string, then extracts the actual quoted substrings and then restores the original formating by rereplacing the temporary placeholder with escaped quotes again. I thought surely there must be a simpler way. I spent 2 hours reading the docs and fiddling around with it and only came up with uglier, slower solutions. That was the first time I felt that I could've really saved time using ChatGPT without sacrificing code quality.
@darrenzou2483
@darrenzou2483 3 ай бұрын
why my aws bill 1.4m
@_Lumiere_
@_Lumiere_ 3 ай бұрын
ZAMN unintelligible regex 😍
@lewesc
@lewesc 3 ай бұрын
Insanely plausible
@nosam1998
@nosam1998 3 ай бұрын
Was literally gonna comment this LOL! I truly think that's what happened too.
@colinmaharaj
@colinmaharaj 3 ай бұрын
You trying to say catastrophic consequences ended up as a catastrophic consequence
@webbugt
@webbugt 3 ай бұрын
You could write a regex for that
@stacklysm
@stacklysm 3 ай бұрын
My brain almost didn't parse this comment
@Niohimself
@Niohimself 3 ай бұрын
@@stacklysm must be an LL(1) comment
@SianaGearz
@SianaGearz 3 ай бұрын
A sequence of catastrophic consequences.
@PakRoc-dev
@PakRoc-dev 3 ай бұрын
it's a recursive catastrophe
@leob3447
@leob3447 3 ай бұрын
"I fumbled the bag harder than Netflix did with Witcher" 40 seconds in and you get a slow clap and a like!
@davidspagnolo4870
@davidspagnolo4870 3 ай бұрын
Is he allowed to say that? lol
@-slasht
@-slasht 3 ай бұрын
Regex is the Bear Grylls survival skill of the tech world. It allows you to do things that most people consider impossible, occasionally it is gross and undignified, and should you find yourself in a situation calling for its use, several things have gone very wrong already.
@0xCAFEF00D
@0xCAFEF00D 3 ай бұрын
I'd recommend Kevin fangs video on this over any blog I've seen. It was excellent. Humorous, well illustrated and explained. Just what I wanted. Excellent channel. Perhaps in poor style to throw this under prime but I just can't recommend it enough. Hoped he was reacting to that video.
@yetanothergamedevchannel
@yetanothergamedevchannel 3 ай бұрын
he did react to kevin once
@andrewcathcart
@andrewcathcart 3 ай бұрын
I mean if you actually watched this video you will see that he starts watching Kevin Fang's video around 11 minutes in.
@not_a_cool_handle
@not_a_cool_handle 3 ай бұрын
kevin fangs deez nutz
@0xCAFEF00D
@0xCAFEF00D 3 ай бұрын
@@andrewcathcart You're right he watches some of it. I wasn't going to rewatch something I know.
@LordFokas
@LordFokas 3 ай бұрын
The end was so dramatic he forgot to say "the name: is don't use regex ... --agen!!"
@JDSchmelzerful
@JDSchmelzerful 3 ай бұрын
Flip has never removed one of these Prime. Good job Flip
@NMiller_
@NMiller_ 3 ай бұрын
Regex is the language of the ancients. It's complexities are beyond mortal minds. When the titans' vacuum tubes were not yet cold, regex was old, and the new gods in Redmond and Los Altos had not yet opened their newborn eyes.
@ktxed
@ktxed 3 ай бұрын
Shit straight from Los Alamos pencil and paper days
@chupasaurus
@chupasaurus 3 ай бұрын
A decade after Ken Thompson unleashed this unholy language into Unix, the e-mail server was born and it speaks only it's own Turing-complete version of regex. Sendmail will drive anyone into madness on the first meet, beware!
@thewiirocks
@thewiirocks 3 ай бұрын
They also warned us: "Many a young programmer with a problem thinks, 'I know! I'll use a RegEx!' Now he has two problems." -JWZ
@daves.software
@daves.software 3 ай бұрын
They were using a back-tracking regex matcher, instead of a DFA-based regex matcher. So yes, it was looping re-matching over and over and over.
@xtieburn
@xtieburn 3 ай бұрын
One of the few times Ive seen some use a high number for increasing importance was while I worked as a shelf stacker in a big store, and over the speakers hear someone in a noticeably panicky voice call out: 'Service call one million. Thats a service call _one million_ ' before managers started sprinting round the store. I still dont actually know if thats an official service call or they just picked a crazy number to get the attention of everyone required, but in case you are interested that meant the entire store system was down. No stock taking, no staff systems, no functioning tills, almost everything was offline. It was a lot of chaotic fun that day. (They got some basic payment procedures up first thing, but without anything else the procedure was to look at shoppers goods, _massively_ underestimate the price and charge that. Everything was down long enough that customers were coming back around and trying to hide expensive items under cheap ones to get even better deals.)
@Zuttoh
@Zuttoh 3 ай бұрын
I've written so much regexes in my lifetime.... that my brain has started liking them. Also, protip to anyone who's tasked into writing a monstrous regex that looks like it could destroy the whole universe, time travel back in time, and destroy it again... Just split the regex into multiple different regex calls, you'll thank yourself next time you need to work on it.
@alexanderjordan2506
@alexanderjordan2506 3 ай бұрын
contains() is nice, but that assumes you're allowed to take input and run it against custom code. Many firewall applications allow you to only enter a pattern to match.
@JohnDoe-yx4hi
@JohnDoe-yx4hi 3 ай бұрын
True, and using `contains()` wouldn't solve the problem anyway; the regex was much more involved than just `/=/`. People really must be regex-blind if they can't see that...
@ssjarchon
@ssjarchon 3 ай бұрын
Regex is fine and a great tool when used for the right job. The problem is that some people try to solve problems that truly need a parser with Regex, or that they don't understand what they are doing at all with it. I recommend creating test suites for your regexes if they are somewhat complex, and the longer they get, consider breaking the problem up. I use regex for doing things like parsing css values, applying automatic formatting to text, or other little tasks all the time.
@SianaGearz
@SianaGearz 3 ай бұрын
Funny how regex is basically the standard way of doing lexer step in a parser.
@theodorealenas3171
@theodorealenas3171 3 ай бұрын
There are 2 cases where I've used regex: in-place text substitution and a personal long shell script that parses itself. I don't dare run regex while I sleep. Regex always execute in front of me.
@CottidaeSEA
@CottidaeSEA 3 ай бұрын
I think the main problem here is that the person didn't understand the consequences of using .* and trying to match a character after that. To achieve the desired result, a negated set would've been perfect for the job. The problem is the readability.
@marcoceriani1069
@marcoceriani1069 3 ай бұрын
@@theodorealenas3171 I've seen a thread in production that has spent more than a day running a very simple regex on an unexpectedly large input. The regex has then been replaced with a string contains and some change in the code. If it's not running in front of me, at least I must be confident that it's always run on text limited in length
@isodoubIet
@isodoubIet 3 ай бұрын
@@CottidaeSEA I think the main problem is really that the person used a regex matching algorithm written by colossally incompetent fools. The entire _reason_ to use regular expression grammars is they're parseable by DFA, that's literally the whole point. Why on _earth_ is it backtracking?
@Burgo361
@Burgo361 3 ай бұрын
I used regex's in my final project at uni it only took a week to work out that I should just write a function the function took a few minutes but I learned something from all of that.
@jelliott3604
@jelliott3604 3 ай бұрын
Ah regex, the way to turn any well defined and understood problem into a set of complex intertwined issues that make your head hurt
@XDarkGreyX
@XDarkGreyX 3 ай бұрын
I started doing [^x]* in those cases ages ago, and I am a junior. Aside from not using regex, there are probably even more enlightened ways to solving that, but you do you CF...
@thekwoka4707
@thekwoka4707 3 ай бұрын
How is that better? Oh so like [^=]*= got it
@gokk99
@gokk99 3 ай бұрын
even better, make it a possessive quantifier: [^=]*+=
@steffahn
@steffahn 3 ай бұрын
really, all you need is a properly implemented and optimized regex engine. It's not exactly cutting edge, finite automata theory is about 70 years old. Of course when computers are "fast enough" and neither the one implementing the regex engine nor the one using it cares to fully optimize their shit, desaster entails.
@soniablanche5672
@soniablanche5672 3 ай бұрын
non capture group means it's a group that will not be added to the results. Sometimes you want to group an expression but don't actually care about capturing their values, so you wrap it in (?: ).
@gregorymorse8423
@gregorymorse8423 3 ай бұрын
It won't be added to the capture groups but it can still be part of the outer match
@FizzlNet
@FizzlNet 3 ай бұрын
RegExp in a code review: "LGTM!" I'm sure he knows what he is doing, if he can write a regexp that complicated...
@DMSBrian24
@DMSBrian24 3 ай бұрын
exactly this
@emilemil1
@emilemil1 3 ай бұрын
Usually what you want to do is split up the string first and then use simpler regexes on the individual parts. If you need more than one .* then you're probably doing something wrong. .*(?:.*=.*) is obviously written by someone who doesn't understand what they are doing. The first .* within the non-capturing group is never going to match anything since the .* before the non-capturing group is going to greedily match all characters before the equals sign. So it's effectively the same as writing .*(?:=.*), except with exponentially worse performance. The performant version would be (.*?=.*).
@ruroruro
@ruroruro 3 ай бұрын
Or [^=]*(?:=.*) if you don't have non-greedy/minimal/lazy quantifiers.
@pdcx
@pdcx 3 ай бұрын
i was just fixing some slow regex using atomic groups, lookahead and timeout and you just reviewed a relevant news. now thats a good coincidence.
@Yotanido
@Yotanido 3 ай бұрын
A single .* is not even the problem. That takes linear time - it's not a big issue. The double .*.* is the problem, since it can't know which of the .* matches which part of the string, so it has to potentially try all possible combinations. Of course, don't use a regex to check if a string contains = lol
@JohnDoe-yx4hi
@JohnDoe-yx4hi 3 ай бұрын
Yes, and the regex in question did more than just checking whether a string contains "=". Prime's reaction... this comment... I expected better. Sad!
@airkami
@airkami 10 күн бұрын
The words “use contains equals” is not the same phrase as “this regex was only checking for an equal sign” You have wrongly concluded that Prime meant the latter when he said the former, but you have failed to realize there is a better explanation for why Prime said “use contains equals” This better explanation appears more than once in the video. First, it appears before he says “use contains equals” you can hear him say “use contains” more than once while highlighting different parts of the text that talk about different parts of what the refer does. That’s because you can write a “contains” line for each part of the reflex statement that is checking to see if the string contains many different things and get the same result as using the regex. Later, we see a diagram of what was being matched in the regex. Again, Prime highlights the individual elements that are listed and says you can “use contains” for each thing being checked for besides the equal sign. Does you understand what I’m talking about here?
@Stealth86651
@Stealth86651 3 ай бұрын
How do you dye your hair semi-transparent?
@raffimolero64
@raffimolero64 3 ай бұрын
you just have to semi-die inside and become a semi-ghost
@theodorealenas3171
@theodorealenas3171 3 ай бұрын
With a lot of yoga or prayers
@trapexit
@trapexit 3 ай бұрын
Where possibly I require all my devs write a function to call the regex and name the function after what it is trying to do + add documentation to explain in English what it is trying to match. edit: tests, in my experience, are just not sufficient. It is very regularly the XY problem. The regex, even with tests, is a solution without a clear articulation of the problem. With teams of mixed skill, may not be devs at all (like data scientists / ML researchers), and English isn't their native language... tests just because manifestations of their ignorance. Blind leading the blind. It becomes much easier to spot an error if the problem is explained in human language.
@gagiotter4114
@gagiotter4114 3 ай бұрын
I force every regex to have a shitload of tests, and then reviewers when they try to see what it could possibly do add more test cases. those test cases end up being better documentation than any comment or whatever.
@trapexit
@trapexit 3 ай бұрын
@@gagiotter4114 Yes, tests are assumed here. But tests don't make the intent clear. You can test something fine but not know what exactly the author intends to match.
@natescode
@natescode 3 ай бұрын
​@@trapexittests definitely clarify what is intended to be matched and what isn't
@doc8527
@doc8527 3 ай бұрын
Test only captures what you know. Test cannot assume what you don't know. It's more an assurance of the past implementation upon the future update. The worse part of regex is that it usually contains a lot of unknown unknowns that many pretend they know. Then the CPU starts to burn. My 2 cents: people who said test is enough never understand the purpose of test nor TDD. Documentation, review to double check if you truly need a regex (95% of the times you don't) is always the way to go.
@doc8527
@doc8527 3 ай бұрын
from my recent bias experience, people who used regex extensively were usually juniors or college kids who obsessed to the fancy one line solution. or just direct copy paste answer from stack overflow or GPT. For their simplest case it works, but always fails in some edge cases nobody thinks of. The solution is the easiest copy-paste without requiring them to read through huge chunk of codes like other solutions (those are actually the one they should copy&paste). Often lead to issue later.
@chickenduckhappy
@chickenduckhappy 3 ай бұрын
Seven String.contains approx. seven times slower than one regex with seven alternative strings bc regex is compiled to a DFA.
@vytah
@vytah 3 ай бұрын
Only if you use a DFA-based regex implementation, which CloudFlare before the outage didn't. Also, contains, especially when looking for a single character, is much faster than any DFA, as it can use SIMD.
@robgrainger5314
@robgrainger5314 3 ай бұрын
If this had been compiled to a DFA there would have been no issue - it would have been deterministic, so not needed any backtracking.
@chepossofare
@chepossofare 3 ай бұрын
I'd rather do it slower but reliable.
@robgrainger5314
@robgrainger5314 3 ай бұрын
@@chepossofare In this case, its both slower and less reliable - which I can't imagine anyone favouring.
@JohnDoe-yx4hi
@JohnDoe-yx4hi 3 ай бұрын
@@vytah Do you think that their regex was only looking for a single character?
@thom1218
@thom1218 3 ай бұрын
The hate for regex is just skill issues being projected. The number of ef'd up substring index arithmetic I see devs fumbling around with to do the simplest pattern extraction is hilarious, and almost always leads to some index out of bounds or NPE error on an input string they didn't consider or unit test.
@kon-jakub
@kon-jakub 3 ай бұрын
I saw the title and immediately knew this vid would be fing good.
@Luclecool123
@Luclecool123 3 ай бұрын
Calling it priority 0 (P0) is actually smart as there is no ambiguity to if it is the highest priority or if there is a higher level than that.
@LordHonkInc
@LordHonkInc 3 ай бұрын
Yeah, I was just about to say that. I mean, what's the alternative? Starting the lowest priority at 1 (or 0) and then your highest priority would be, what, INT_MAX? xD I think every priority system I can think of works this way: DEFCON, protection rings, etc.; even just saying "it's my top priority," like, where do you put that in a list? At the beginning, number 1 spot of a list, not all the way at the bottom, right? "My top five movies! My favorite, at number 5..." Nobody would do that
@pluto8404
@pluto8404 3 ай бұрын
if you put your priorities in an array, the 0th index would be the first priority.
@abz4852
@abz4852 3 ай бұрын
*Julia would like to speak with you for a moment*
@christopheriman4921
@christopheriman4921 3 ай бұрын
I mean you could see priority negative infinity as the highest priority considering you should have done that before all of the negative number priorities and positive number priorities so it isn't entirely unambiguous.
@Luclecool123
@Luclecool123 3 ай бұрын
@@christopheriman4921 ok propose that to your boss xd
@jearsh
@jearsh 3 ай бұрын
"i fumbled the bag harder than amazon prime did with wheel of time"...i felt that
@batboy49
@batboy49 3 ай бұрын
@4:40 you got that right I thought it was just me. I cannot help myself I glaze over everytime a regex is there and I have tried and tried to just master it.
@ea_naseer
@ea_naseer 3 ай бұрын
Regex exits Me: Oh finite automata...
@0xCAFEF00D
@0xCAFEF00D 3 ай бұрын
NFA specifically I think. If this is the cloud flare issue I'm thinking of.
@pianissimo7121
@pianissimo7121 3 ай бұрын
As someone who learnt Finite Automata just weeks ago, this is the 1st thing that came to mind.
@LtdJorge
@LtdJorge 3 ай бұрын
@@0xCAFEF00D Yep, NFA. Although I’m pretty sure it can be turned into DFA.
@atijohn8135
@atijohn8135 3 ай бұрын
@@0xCAFEF00D nfas would be more or less fine in this situation (they have linear complexity), the regexp engine they used did *not* use an automaton, but a simple recursive backtracking algorithm (i.e. for Kleene stars consume as much characters as possible, then match one less on each failure, for alternatives just try them left to right until they succeed; this has exponential complexity for obvious reasons)
@VivekYadav-ds8oz
@VivekYadav-ds8oz 3 ай бұрын
@@atijohn8135 NFAs use backtracking and have exponential complexity. If you first convert it to DFAs though then it's fine.
@TymurDaudov_aka_tymfear
@TymurDaudov_aka_tymfear 3 ай бұрын
We had a saying in one of the teams - "if you solve your problem with regex - now you have 2 problems"
@another212shadow
@another212shadow 3 ай бұрын
That's JWZ's quote that is at least 15 years old:.
@TymurDaudov_aka_tymfear
@TymurDaudov_aka_tymfear 3 ай бұрын
@@another212shadow didn’t say we invented it, just that we had it. Btw, have no idea who JWZ is, sorry
@another212shadow
@another212shadow 3 ай бұрын
Jamie Zawinski It was his .sig file and he says he took it off of an older sed joke. en.wikipedia.org/wiki/Jamie_Zawinski
@specterent
@specterent 3 ай бұрын
Just loved the ending..."AIs were trained off stack overflow, stack overflow uses regex to solve everything. Oh no!"
@TurtleKwitty
@TurtleKwitty 3 ай бұрын
Priority makes sense, think of it as a todo list; priority 1 menas its the first item on the list and therefor higher priority on the list (physically) priority 0 is "dont even write it down just do it"
@creativecraving
@creativecraving 2 ай бұрын
I just came here for the intro. Was not disappointed! 😅
@alh-xj6gt
@alh-xj6gt 3 ай бұрын
Going by owasp XSS Filter Evasion Cheat Sheet there is a lot of different encodings possible. Also per XSS target there are different layers of filter evasion possible. Just from that I would like to have statistics of what different encodings are used and to see attack pattern before filtering resulting strings that will confirm XSS escaping techniques or not. regex rally doesn't give that kind of granularity to dissect and emit throughout parsing towards the resulting string.
@UnFiltered1776
@UnFiltered1776 3 ай бұрын
I love how the chromakey replaces the hair.
@havocthehobbit
@havocthehobbit 3 ай бұрын
Regular expressions are extremely fast over large chunks of text not large amounts of chunks. It's made for scale in size but not quantity. Run regex over 100 thousand lines in nano seconds but run the same over 100 thousand times on individual lines and it costs a few seconds. It's one of those use sparingly things and they can hard to read wen sharing with teams, I a oid them when possible
@ZingsVideos
@ZingsVideos 3 ай бұрын
"Now you have two problems."
@TECHN01200
@TECHN01200 3 ай бұрын
Flip's editor humor as of lat has been on point.
@limesta
@limesta 3 ай бұрын
Think of priorities as 1/X The bigger the number the higher the priority. P0 means not only mission critical, but company killing if its not addressed.
@mitchierichie
@mitchierichie 3 ай бұрын
You said compartmentalized correctly the first time 😅
@CottidaeSEA
@CottidaeSEA 3 ай бұрын
I recently added a regex to validate locale strings. It became uglier than I expected, but it was also simpler than I thought. Most important of all, it's not going to break shit. I do kind of wish I had just split the string into two parts and validated each part individually though.
@reed6514
@reed6514 3 ай бұрын
I love regex, but yeah if you can split the string on a known delimeter, i find that is usually easier to work with.
@choovick
@choovick 3 ай бұрын
Simple rules might not cut it in the firewall rules engines, so they give you refex as more flexible option. And most ppl shoot themselves in the foot... Cloudflare was just big enough to notice.
@darnaram
@darnaram 3 ай бұрын
What I want to know is whether there is a good course for regex so that I never get screwed for the same
@gauff3r
@gauff3r 3 ай бұрын
The most interesting part is the end - explanation
@demolazer
@demolazer 3 ай бұрын
Using a long regex for something of this magnitude is insane. The slightest extra character, an erroneous space, can blow the whole thing.
@beatboy6690
@beatboy6690 3 ай бұрын
What would you use otherwise?
@sack-shaw
@sack-shaw 3 ай бұрын
@@beatboy6690 at this level of complexity, you should probably write your own parser by hand.
@natescode
@natescode 3 ай бұрын
​@@sack-shawwhich will be 1000X more characters with possible errors.
@chepossofare
@chepossofare 3 ай бұрын
I'd rather write a bunch of "contains", regexps are a viable option imho only if your output is insanely random.
@chepossofare
@chepossofare 3 ай бұрын
@@sack-shaw +1 for the parser, which is testable and reliable.
@HolgerNestmann
@HolgerNestmann 3 ай бұрын
In my line of work Regexps are often used in configs. Because „uhh no code change?“, no matter how well a CD is setup. So one rather has to fumble with a regexp
@erictrinque6513
@erictrinque6513 3 ай бұрын
Flip again and always the Realest MVP. .. Prime... Quit Strokin out bruh, get you a coffee
@pupfriend
@pupfriend 3 ай бұрын
Little known fact. Regex was invented by the same guy who invented water boarding.
@psyience3213
@psyience3213 3 ай бұрын
wild cards are great when you have a long file or directory name but the first few letters are unique.
@animanaut
@animanaut 3 ай бұрын
chat: zip codes ... easy uk: kind sir, do i look like a humerous joke to you?
@ioulios12
@ioulios12 3 ай бұрын
loved this video
@wlockuz4467
@wlockuz4467 3 ай бұрын
When I first write a regex only I and god understand what it does. When I look at the same regex later only god understands what it did.
@darkdudironaji
@darkdudironaji 3 ай бұрын
I was half expecting another 17 minutes of " I fumbled the bag harder than Amazon Prime did with..."
@Bolpat
@Bolpat 3 ай бұрын
10:00 Dude, the non-capture group just means the same as a normal group, but it doesn't record what it captures for later. It's definitely not the problem.
@ConernicusRex
@ConernicusRex 3 ай бұрын
P0 is "Priority 0" the highest possible outage/bug priority. It's an all-hands-on-deck fuckup situation. Anything P0 means the company is on fire. (They use this terminology at Netflix, i'm not sure why Prime doesn't know it).
@abhinavlakhani5637
@abhinavlakhani5637 3 ай бұрын
I'm liking this video because of you flip
@conceptrat
@conceptrat 3 ай бұрын
I see you're doing the whole blue green thing now 😂
@eppiox
@eppiox 3 ай бұрын
That ending realization ☠
@conceptrat
@conceptrat 3 ай бұрын
Lesson learned. Too many sheriff's in Tombstone!
@lexer_
@lexer_ 3 ай бұрын
Does anyone know if just adding questionmarks after the greedy matches before the "=" would have fixed the exponential scaling because it wouldn't be greedy anymore like this? .*.*?=.* Or ignoring the non-captcha groups because the don't really do anything here could just ".*?=.* do the same job without scaling terribly? Or do regex engines internally still match greedily and scale terribly with constructs like this?
@DieterPrivate
@DieterPrivate 3 ай бұрын
Finally someone that knows how to use ?. I was searching the comments for this. I use it all the time.
@KingsKeep
@KingsKeep 3 ай бұрын
His realization at the end had me crying 😂😂😂 We're all doomed!!
@tofonofo4606
@tofonofo4606 3 ай бұрын
I am realizing that flip may bring me as much joy as Prime does. ( maybe more, don't tell daddy. I know he don't read yt comments )
@tc4v
@tc4v 3 ай бұрын
What's wild is that this problem isn't possible with NFA regex engine, which has been known for decades, and implemented in things like grep and Go.
@DuneNobleman
@DuneNobleman 3 ай бұрын
The ending was the best... 🤣
@VoxelPrismatic
@VoxelPrismatic 2 ай бұрын
regex is very useful for separating strings based on patterns, like for syntax highlighting or markup. this is a horrendous misuse of regex
@acharris
@acharris 3 ай бұрын
REGEX is the darkest of black magic. It's power - boundless. It's danger - unfathomable. Even Great Cthulhu shudders at its blasphemous might!
@user-lz2oh9zz4y
@user-lz2oh9zz4y 3 ай бұрын
Who would win? A global scale 35 billion dollars company, or one regex boy .*.* = .*
@elgalas
@elgalas 3 ай бұрын
Woah, we talked about this at work today
@Logan9312
@Logan9312 3 ай бұрын
Reminded me of the wheel of time failure 😢
@dutchcaveman2937
@dutchcaveman2937 3 ай бұрын
And this is why i define REGEX_DEFAULT_MATCH_TIMEOUT so the CPU won't hang on a RegEx, instead it throws an exception when timeout has been reached.
@HimothyOHooligan
@HimothyOHooligan 3 ай бұрын
The Witcher reference made me feel so seen.
@arthurmorgan8966
@arthurmorgan8966 3 ай бұрын
Kevin Faang's video on this was quite good.
@jamauldrew
@jamauldrew 3 ай бұрын
Regex is just a hope and a prayer 🙏 😂
@CoderDBF
@CoderDBF 3 ай бұрын
What I like about Regex is that you can define a pattern and then the sequence you give it must match that specified pattern. Personally I think Regex is a genius invention, I love them, I use them all the time.
@kylek.3689
@kylek.3689 3 ай бұрын
This guy coming out with a generic ass ChatGPT comment 🤖
@dakata2416
@dakata2416 3 ай бұрын
Where is your Regex license?
@sexwax4191
@sexwax4191 3 ай бұрын
No one, literally NO ONE, fumbled as hard as netflix did with the witcher series.
@Bolpat
@Bolpat 3 ай бұрын
I'd say, as a rule, if you reviewed a PR and something bad happens because it's been merged, you have twice the fault of the person who wrote it. Seeing errors in someone else's code is so much easier than seeing errors in your own code.
@claudiusraphael9423
@claudiusraphael9423 3 ай бұрын
We need more Eggscape-sequences.
@MorgurEdits
@MorgurEdits 2 ай бұрын
One thing to midigate regex readability is to use verbose option always when possible then you can explain each line of regex with comments for example.
@RenderingUser
@RenderingUser 3 ай бұрын
bro's hair is now almost entirely alpha
@JonnyRobbie
@JonnyRobbie 3 ай бұрын
so, what was the bet he lost?
@RenderingUser
@RenderingUser 3 ай бұрын
@@JonnyRobbie I don't even know
@stacklysm
@stacklysm 3 ай бұрын
Bro got the #00FF00D7 hair tint
@desertfish74
@desertfish74 3 ай бұрын
blue hair
@tropickslol
@tropickslol 3 ай бұрын
​@@JonnyRobbie he basically did a sub goal
@logon-oe6un
@logon-oe6un 3 ай бұрын
God simply didn't give the average human read permissions for Regex. Who are we to defy the sysadmin of our universe.
@ElvenSpellmaker
@ElvenSpellmaker 2 ай бұрын
This reminds me of the Stackoverflow Regex outage.
@Bolpat
@Bolpat 3 ай бұрын
9:50 As I see it, the issue is .* as it matches any sequence of anything. I never use .* except for matching stuff up to the end of line. it's the root of all backtracking evil. Whenever you find yourself writing .*x, write [^x]*x instead. If your engine supports it, use [^x]*+x. In the video, the x is =.
@DieterPrivate
@DieterPrivate 3 ай бұрын
Yup, and also use ? to indicate not to be greedy.
@leshommesdupilly
@leshommesdupilly 3 ай бұрын
Is there a way to write in a more "readable" language then "compile" it into regex ? I hate regex, but I need it >
@SundaraRamanR
@SundaraRamanR 3 ай бұрын
Julia has a ReadableRegex library that lets you write `maybe(["-", "+"]) * maybe(zero_or_more(DIGIT) * ".") * one_or_more(DIGIT)` to match numbers, including signs and decimal points. It then auto converts that into a "normal" regex you can use anywhere.
@jacksoncremean1664
@jacksoncremean1664 3 ай бұрын
yes, there are regex toolchains
@PhillipDressen
@PhillipDressen 3 ай бұрын
Presume you have a problem. You solve that problem with a regex. Now you have two problems.
@JohnDoe-yx4hi
@JohnDoe-yx4hi 3 ай бұрын
Ya, the second problem is figuring out what to do with all of the free time that I got from solving the first problem with such great speed.
@WralthChardiceVideo
@WralthChardiceVideo 3 ай бұрын
I like how the regex isnt even all that complex but they still messed it up and quite honestly, I guess that could happen to the best of us. None of this is an argument against regex itself. It's just a pattern matching DSL after all that isn't even all that complicated.
@Oscaragious
@Oscaragious 2 ай бұрын
I actually find it relatively easy to read regex, especially enough to know most people don't know how to write it well.
@dv_xl
@dv_xl 3 ай бұрын
Proper non backtracking DFA regexs are a really useful tool as they can be composed in linear time, 1000 parsing rules can become one really efficient one. But I agree using it for things like zip codes or emails is danger zone.
@mikescholz6429
@mikescholz6429 3 ай бұрын
Don’t feel bad, I stumble almost every time I say “Sausage McMuffin”
@electrolyteorb
@electrolyteorb 3 ай бұрын
That Article by Aditya is such a clusterfck... Too much foreplay
@electrolyteorb
@electrolyteorb 3 ай бұрын
And only foreplay
@jeffreyblack666
@jeffreyblack666 2 ай бұрын
I think those priority things would work better the other way around. It isn't priority 1, it is the 1st priority. (and P0 is the 0th, must be dealt with before the 1st).
@Wyklepheph
@Wyklepheph 2 ай бұрын
Lmao, had to do backend sanitization of form data and thought “I could regex this” then I was like “why tf wouldn’t I just .contains?
@hukasu
@hukasu 3 ай бұрын
reminds me of when stackoverflow got taken down by a regex trying to parse 20000 white spaces
@blinking_dodo
@blinking_dodo 3 ай бұрын
Why would people skip over Regex'es? I would always wonder if it's a correct (and valid) regex...
@JohnDoe-yx4hi
@JohnDoe-yx4hi 3 ай бұрын
Same. I don't know what's wrong with these people. I don't know how they can be so proud of their ignorance.
@lpanebr
@lpanebr 3 ай бұрын
Seriously, Flip never does what you ask! 😂😂
@Afro__Joe
@Afro__Joe 3 ай бұрын
All I know is regex getting into all this... I got my eye out. Hopefully 😂
@B52-ge8qy
@B52-ge8qy 3 ай бұрын
Beast!
@mavriksc
@mavriksc 3 ай бұрын
You need a foot switch so you can timestamp clips or whatever was going on at the end hands free
@Dom-zy1qy
@Dom-zy1qy 3 ай бұрын
I think being a regex god is a characteristic of a 10x developer. Im not gonna lie though i have procrastinated learning regex for years and just end up "bruteforcing" a regex on the occasion i need one.
@sdi87hhk
@sdi87hhk 3 ай бұрын
Moar like RektEx
Git Is Awful | Prime Reacts
23:10
ThePrimeTime
Рет қаралды 194 М.
JSON, TOML, YML? No! Apples New Config Lang!
29:19
ThePrimeTime
Рет қаралды 141 М.
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 3,5 МЛН
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 82 МЛН
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 769 М.
Cloudflare Deploys Really Slow Code, Takes Down Entire Company
13:24
The Truth About The Fast Inverse Square on N64 | Prime Reacts
16:59
Is clean code a LIE? Primeagen x Casey Muratori say so
14:15
BHolmesVods
Рет қаралды 1,9 М.
1000x FASTER JavaScript?
29:17
ThePrimeTime
Рет қаралды 128 М.
i woke up to this?
20:50
ThePrimeTime
Рет қаралды 133 М.
ThePrimeagen On Running Linux
9:40
Tech Over Tea
Рет қаралды 178 М.
Rust for TypeScript devs : Borrow Checker
8:49
ThePrimeagen
Рет қаралды 211 М.
Code That MURDERED 6 People | Prime Reacts
17:57
ThePrimeTime
Рет қаралды 214 М.
Why Linus Torvalds Insults People | Prime Reacts
17:53
ThePrimeTime
Рет қаралды 312 М.
The Stockholm Syndrome of SQL | Prime Reacts
31:21
ThePrimeTime
Рет қаралды 120 М.
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 9 МЛН
POCO F6 PRO - ЛУЧШИЙ POCO НА ДАННЫЙ МОМЕНТ!
18:51
3.5.A Solar Mobile 📱 Charger
0:39
Gaming zone
Рет қаралды 320 М.
#miniphone
0:18
Miniphone
Рет қаралды 11 МЛН
😱НОУТБУК СОСЕДКИ😱
0:30
OMG DEN
Рет қаралды 2,7 МЛН