Using Regular Expressions - Computerphile

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2020
  • Professor Brailsford takes the theory of RegEx and puts it into practice.
    EXTRA BITS: • EXTRA BITS - History o...
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscomputer
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

ความคิดเห็น • 244

  • @ashishacharya4001
    @ashishacharya4001 4 ปีที่แล้ว +258

    I wish I could have a long and deep conversation with Professor Brailsford over an afternoon tea. He's so Jolly.

    • @AcornElectron
      @AcornElectron 4 ปีที่แล้ว +8

      Ashish Acharya yeah, I’d be happy just being on the next table in that pub and listening in.

    • @volodyadykun6490
      @volodyadykun6490 4 ปีที่แล้ว +2

      At least listen to him at lecture
      ...Wait, is it going right now?

    • @ct92404
      @ct92404 4 ปีที่แล้ว +8

      If I could afford to take a trip to the UK, I would come out there just to have a chance to meet Professor Brailsford!

    • @WillYouVid
      @WillYouVid 4 ปีที่แล้ว +3

      He is jolly but I have a tendency to falling asleep in the middle of his explainations

    • @ct92404
      @ct92404 4 ปีที่แล้ว +4

      @@WillYouVid You must be a Millennial.

  • @mal2ksc
    @mal2ksc 4 ปีที่แล้ว +220

    Obligatory xkcd:
    "I have a problem. I know, I'll write a regexp for it! Now I have two problems."

    • @downstream0114
      @downstream0114 4 ปีที่แล้ว +4

      The xkcd is a different version of that saying, but same idea.

    • @BangBang-te3mi
      @BangBang-te3mi 4 ปีที่แล้ว

      I dont get it, somebody pls explain.

    • @Krissam2k
      @Krissam2k 4 ปีที่แล้ว +9

      @@BangBang-te3mi The new problem is he needs to figure out the regex syntax

    • @BangBang-te3mi
      @BangBang-te3mi 4 ปีที่แล้ว

      @@Krissam2k ah haha thanks

    • @kpYak
      @kpYak 4 ปีที่แล้ว +6

      @@BangBang-te3mi Or that the RegEx written is *almost* correct.

  • @SudaNIm103
    @SudaNIm103 4 ปีที่แล้ว +89

    I’m really enjoying these videos; My knowledge of RegEx is entirely practical, and limited to contemporary uses for string validation, matching, and parsing. I had presumed some ultimate shared origin with lexical grammar theory, but I had no idea it was so diverse and fundamental.

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว +11

      Wait until you see the diversity of regex engines out there and the performance implication thereof. Backtracking, backtracking with cache, multistate-NFA, lazy-DFA, DFA, DFA with filtering check for non-regular features, DFA filtering + backtracking. There's a lot if techniques out there.

  • @userou-ig1ze
    @userou-ig1ze 4 ปีที่แล้ว +20

    please a more in-depth regex part 2 video!! Vote up if agree!

  • @tomvleeuwen
    @tomvleeuwen 4 ปีที่แล้ว +91

    4:21 The video-editor is clearly less experienced with regex, leaving out the essential asterisk...

    • @profdaveb6384
      @profdaveb6384 4 ปีที่แล้ว +69

      Aaaagh!!! Well spotted!! As you can imagine,that trailing asterisk *is* there in the actual program (otherwise VARNAMES wouldn't get recognised) but it's somehow fallen off during the highlighting of the regex .... Apologies.

    • @toxicbubble5
      @toxicbubble5 4 ปีที่แล้ว +9

      @@profdaveb6384 clearly visible on the paper printout at 4:15 :D

    • @silaspoulson9935
      @silaspoulson9935 4 ปีที่แล้ว

      @@profdaveb6384 Might be worth enabling program as downloadable file

    • @miguelpaz1579
      @miguelpaz1579 4 ปีที่แล้ว

      OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @BergenVestHK
    @BergenVestHK 4 ปีที่แล้ว +4

    Professor Brailsford always brightens my day. Thank you so much!

  • @PopeLando
    @PopeLando 4 ปีที่แล้ว +4

    Here's a little unexpected connection. My favourite little function that I wrote is to convert any number into its Roman numerals. And I used both recursion AND regexes to do it! It's nice that these are both areas Prof. Brailsford is the Numberphile expert on, because I'm such a huge fan.

    • @novamc7945
      @novamc7945 2 ปีที่แล้ว +1

      How did you do it?

  • @steve1978ger
    @steve1978ger 4 ปีที่แล้ว +3

    To get close and personal with regular expressions, I would recommend the command line tools egrep (for searching text) and sed (to search and replace text). Both deliver immediate results and are very useful and versatile tools in their own right.

  • @pianochannel100
    @pianochannel100 4 ปีที่แล้ว +1

    I just finished building a lexer and a parser in C for a new programming language. I'm here to listen to the professor more than anything else.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 4 ปีที่แล้ว +53

    Some people, faced with the problem of comprehending a presentation on regular expressions, like to distract themselves with a well-known and overused Jamie Zawinski quote. Now they have two problems ...

    • @DaVince21
      @DaVince21 4 ปีที่แล้ว +4

      I love that your comment was right above said Jamie Zawinski quote for me.

    • @DaVince21
      @DaVince21 4 ปีที่แล้ว

      @@miguelpaz1579 Yes!

  • @wakiilcaashaq8270
    @wakiilcaashaq8270 4 ปีที่แล้ว

    Am actually doing this in this semester and the prof is really teaching superbly.

  • @suicidalbanananana
    @suicidalbanananana 4 ปีที่แล้ว +8

    Next video should be about RFC5322 and how insane regex can become (to a point where its actually quite terrible for what most people use it for)

  • @laxr5rs
    @laxr5rs 4 ปีที่แล้ว +9

    When I worked at Yahoo! years ago my Boss used to quip, "regular expressions are anything but regular."

  • @jaspervaldivia6098
    @jaspervaldivia6098 4 ปีที่แล้ว +8

    I would to be enrolled in one of his classes, or to help with his research. A truly inspiring and engaging professor, I am sure.

  • @TofuBug24
    @TofuBug24 4 ปีที่แล้ว

    The best part of the video is this expert with decades of experience still gets visibly disturbed by the sheer scope of what Regular Expressions are. Makes me not feel so bad when even after decades of using them myself I still get that sinking feeling in my stomach any time i have to figure out a non trivial Regular Expression I might not have looked at in 6 months or more

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      Best is to avoid such situations, by keeping your REs simple.

    • @TofuBug24
      @TofuBug24 4 ปีที่แล้ว +1

      @@lawrencedoliveiro9104 Yeah because a validation regex for things like a valid email address defined in the RFC document is SUPER simple...

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      @@TofuBug24 That’s the kind of (mis)use of regexes Jamie Zawinski had in mind when he made his famous quote.

  • @iamTheSnark
    @iamTheSnark 4 ปีที่แล้ว

    I still use TSE (The Semware Editor) which lets me use regular expressions in its script language. Works for me.

  • @lank_asif
    @lank_asif 4 ปีที่แล้ว

    What a lovely guest!

  • @LoneWolf-wp9dn
    @LoneWolf-wp9dn 4 ปีที่แล้ว +51

    Some people, when confronted with a problem, think "I know, I'll use regular expressions."
    Now they have two problems.

    • @magnusschollin9583
      @magnusschollin9583 4 ปีที่แล้ว +5

      I use it a bounch for Powershell scripts and it is insanely useful, but yes sometimes you do get stuck :D
      regex101 website help ALOT, usually fixes the expression in seconds.

    • @hattrickster33
      @hattrickster33 4 ปีที่แล้ว

      @@magnusschollin9583 Yeah that site is really useful. Even if you understand RegEx it works, it saves a lot of time. Sad thing is that they won't let you use it on code tests.

  • @ct92404
    @ct92404 4 ปีที่แล้ว +6

    Professor Brailsford! Yay!!

  • @ZipplyZane
    @ZipplyZane 4 ปีที่แล้ว +1

    I use regex mostly to search existing strings. It will allow me to capture portions of data, replace data, or simply tell me if the string is okay.
    And it works just fine for this both in userscript and when searching a document.
    I actually don't know why else you would use it, nor why it would be bad in this context.

  • @andrewwmitchell
    @andrewwmitchell 4 ปีที่แล้ว +3

    Oh my goodness, that's Principles of Compiler Design next to his monitor. Wow, that was one of my Computer Science textbooks, last century.

    • @Sharklops
      @Sharklops 4 ปีที่แล้ว

      I love that cover design

  • @pete.n.
    @pete.n. 4 ปีที่แล้ว +2

    Much better than the previous regex video

  • @kurtu5
    @kurtu5 4 ปีที่แล้ว +31

    Regex can't cope? Thats AWKward.

    • @gajbooks
      @gajbooks 4 ปีที่แล้ว +5

      Or as Professor Brailsford would say, Orcward.

  • @deidara_8598
    @deidara_8598 4 ปีที่แล้ว +15

    Honestly I feel like windows 7 is better, at least I don't get pestered with update notices every 15 minutes, and the UI is just so much clearner and intuative, not to mention that windows 10 comes with half the drive filled with adware, a lot of it is near impossible to uninstall. If security is of concern, use Linux.

    • @Chriva
      @Chriva 4 ปีที่แล้ว +3

      Just get w10 pro. Easy to remove every single app and chose not to install anything else than stable updates.

    • @deidara_8598
      @deidara_8598 4 ปีที่แล้ว +6

      @@Chriva Honestly if I have to fork out an extra $90 just to install it without crapware, whilst having virtually nothing different except worse UI, updates shoved down my throat constantly, and having to deal with a bunch of compatibility issues with programs intended for older versions of Windows, I think I'll just stick with 7.

    • @archiemisc
      @archiemisc 4 ปีที่แล้ว

      @@deidara_8598 You can uninstall the "crapware" you know

    • @deidara_8598
      @deidara_8598 4 ปีที่แล้ว +3

      @@archiemisc Have you ever tried uninstalling candy crush on windows 10? You can't do it by the convetional methods, it won't allow you to delete the files, even with administrator, and if you try to use control panel it'll just flip you off. No, if you want to uninstall candy crush and the other junk they obnoxiously bloat your drive with what you have to do is to go into powershell as administrator, find the ID of the app you want to uninstall, then copy that id, then remove the app using the Remove-AppxPackage command, and that's just one of the bastards, imagine doing that 50 times over, and you'll realize that maybe it's just easier to stay of Windows 10 all together.

    • @PrettyBlueThings
      @PrettyBlueThings 4 ปีที่แล้ว +1

      @@deidara_8598 deidara _ imagine doing get-appxpackage and piping that to remove-appxpackage! :O
      You're welcome!

  • @Ceelvain
    @Ceelvain 4 ปีที่แล้ว +1

    Does lex (or flex) compile a full blown determinitstic automaton with the union of all the regexes? Or does it try them all in sequence?
    Both approaches have their pros and cons.

  • @PatrickPoet
    @PatrickPoet 4 ปีที่แล้ว

    When I was in college in the mid-80s I was using unix boxes and learning regex's was really important, but there were little difference between lex and awk and file globbing and others.

  • @cc.jsullivan
    @cc.jsullivan 4 ปีที่แล้ว +1

    > 3:30 AM PST
    > New Prof. B video
    > About regex
    I'll tell you one regex I wouldn't write, but I'll stay for Dave :^)

  • @docpify
    @docpify 4 ปีที่แล้ว +26

    I actually implemented the IRC protocol as a regex about 20 years ago :)

    • @chair547
      @chair547 4 ปีที่แล้ว +1

      You... WHAT?

    • @fitzroyfastnet
      @fitzroyfastnet 4 ปีที่แล้ว +11

      Github or it didn't happen.

    • @deoxal7947
      @deoxal7947 4 ปีที่แล้ว +1

      @@fitzroyfastnet Well not just Github

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว +1

      you mean the parsing part of the commands? Possible, considering their syntax not being too complicated - or do I miss something?

    • @docpify
      @docpify 4 ปีที่แล้ว +1

      @@FrankHarwald I wrote a single regular expression (using the C PCRE library) to parse incoming lines of text from the IRC server, then branching logic looking at what subpatterns had matched

  • @mubafaw
    @mubafaw 2 ปีที่แล้ว

    Professor Brailsford! Many thanks 😃👍

  • @ludvercz
    @ludvercz 4 ปีที่แล้ว +6

    "Some of you know way more than I do"
    (x) - Doubt

  • @lauragaleraalfaro8086
    @lauragaleraalfaro8086 3 ปีที่แล้ว +1

    He is so cute explaining 😆 and the topics are always the best

  • @DeusGladiorum
    @DeusGladiorum 4 ปีที่แล้ว +10

    I'd love a regular expression video on catastrophic backtracking!

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว +3

      And then a video on how the solution is known since 1968.

    • @deoxal7947
      @deoxal7947 4 ปีที่แล้ว +1

      @@Ceelvain Do tell us

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว

      yes, but these sort of things would probably better go to computerphile 2 because they tend to be beyond what beginners can easily comprehend.

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว +2

      @@deoxal7947 Well, don't implement regular expressions with backtracking. Ken Thompson (the one that made C and Unix) published a 4 pages paper in 1968 titled "Regular expression search algorithm". In it he describe an algorithm to compile a regular expression into machine code for the IBM 7094.
      The generated code perform a breadth-first search on the non-deterministic automaton. The algorithm still has exponential cases, but an easy fix is noted at the end of the paper. Which he implemented in this text editor QED.
      Anyway, the idea of the algorithm is that you read each character of the input string only once. And at each step, you activate all the states of the non-deterministic automaton that are reachable with that character. If you're careful to not activate the same state twice, then you have a linear-time algorithm.
      The reason it's rarely implemented like this is that it's harder to implement all the bells and whistles people want in their regex today. It's possible to implement counted repetitions, but it migh take a lot of memory. And backreferences are proven to be NP-Hard to match so there will always be cases that take an exponential amount of time if you support them. In fact backreferences bring new matching power to the regexes. They're no longer "regular" and thus should not be called "regular expressions". There seem to be an implicit agreement to call them "regex" and keep "regular expression" when it' s the mathematically correct term.

    • @DeusGladiorum
      @DeusGladiorum 4 ปีที่แล้ว

      Frank Harwald there’s a second Computerphile channel? Also I don’t think that’s beyond comprehension for most computerphile viewers. It’s basically just another video on why RegEx works the way it does. Once you understand that a RegEx isn’t magic, and that it actually works as well as it does because it basically brute forces its search algorithm, then you begin to think about why and when it does so and how to prevent it.

  • @Brenna_stubbs
    @Brenna_stubbs 4 ปีที่แล้ว +6

    I'm now going to call all my integers Bob the Builder

    • @DaVince21
      @DaVince21 4 ปีที่แล้ว

      Bob the expression builder.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 4 ปีที่แล้ว +11

    8:34 So lex was written by a guy named Lesk. So near, and yet so far ...

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว +1

      Guess it's like Linux & Linus.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      @@FrankHarwald That one was no coincidence.

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว

      @@lawrencedoliveiro9104 I guess both were not coincidences

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      @@FrankHarwald No, the one I mentioned was indeed a (near) coincidence.

  • @Arcsecant
    @Arcsecant 4 ปีที่แล้ว +9

    Regexes are definitely my favorite write-only language.

    • @EnteiFire4
      @EnteiFire4 4 ปีที่แล้ว

      You clearly haven't written any Perl.

  • @webchimp
    @webchimp 4 ปีที่แล้ว

    Only time I've used RegEx was when I set up a forum at uni and needed to filter out non uni emails from the sign up section.

  • @zyghom
    @zyghom 4 ปีที่แล้ว

    being handy with regex is vital with processing anything with text. And seriously speaking it can be very complicated ;)

  • @RysorZX
    @RysorZX 4 ปีที่แล้ว

    Got an exam on this tomorrow... couldn't have come at a better time

  • @stefanvestergaard
    @stefanvestergaard 4 ปีที่แล้ว

    The first thing I noticed when I started the video was Windows 7... Thanks for the heads up! :D

  • @cidercreekranch
    @cidercreekranch 4 ปีที่แล้ว +1

    Is that a first edition of the dragon book?

  • @dlarge6502
    @dlarge6502 4 ปีที่แล้ว +2

    Now I'm off to read the lex man page

  • @marksusskind1260
    @marksusskind1260 4 ปีที่แล้ว +1

    Please include CC transcript for the hearing {or spelling} impaired

  • @noredine
    @noredine 4 ปีที่แล้ว +9

    when i discovered $1, it saved me a lot of time and it's fun to use

    • @Dorumin
      @Dorumin 4 ปีที่แล้ว +2

      Capturing groups are most likely one of the most essential tools for regular expressions

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว +10

      Don’t spend it all at once.

    • @llearch
      @llearch 4 ปีที่แล้ว

      $NF in awk is my go-to for obscure clever things. Super handy.

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว +1

      Do you mean extracting content of the parentheses in the host program? Or reusing it in the regex like /(doc|cat)\1/ would match "dogdog" or "catcat" only?
      The first one is a core tool that makes regex useful. The second one (called backreferences) makes the language non-regular. Actually, we shouldn't call these "regular expressions". They are also pretty difficult to match (proven NP-complete).

    • @JNCressey
      @JNCressey 4 ปีที่แล้ว

      I was very happy to discover the multi-line flag.

  • @aliedperez
    @aliedperez 4 ปีที่แล้ว +2

    when you need to fix a customer support request and all you have is a rough date and time, a user id and (metric)tonnes of logs.

  • @CSTRSK
    @CSTRSK 4 ปีที่แล้ว +1

    I love to work it regex ❤

  • @charstringetje
    @charstringetje 4 ปีที่แล้ว +10

    I'd expect someone like prof. Brailsford to be more comfortable with one of the *Nixes on his pc.

  • @Lighter-vp7un
    @Lighter-vp7un 3 หลายเดือนก่อน

    Grandpas like this should be the one on senate asking tech CEO's.

  • @j0hn3ntwistle
    @j0hn3ntwistle 4 ปีที่แล้ว +3

    If David Attenborough taught computer science!

  • @madhmpf
    @madhmpf 4 ปีที่แล้ว +2

    Now i'd like to see what happens if you feed it, let's say "trampoline" or "archery"

    • @longlostwraith5106
      @longlostwraith5106 4 ปีที่แล้ว

      lex is greedy, which means it takes as many characters as possible before matching. For that reason alone, it would rather match "trampoline" as a variable than "trampo" as variable and "line" as reserved.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 4 ปีที่แล้ว +1

    3:12 By “letter” do you include everything in Unicode classes Ll and Lu? Because, you know, we don’t live in an ASCII-centric world any more...

    • @RealCadde
      @RealCadde 4 ปีที่แล้ว +1

      As evident by the regex, only A-Za-z so no, not a single non-english letter.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      @@RealCadde But even English uses diacritics. For example, “resumé” versus “resume”.

    • @JanBruunAndersen
      @JanBruunAndersen 4 ปีที่แล้ว +1

      That's easily fixed. Just use [:alpha:].

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      @@JanBruunAndersen Be careful, though. Those sorts of things can be localization-dependent, which is not what we want here.

    • @joaomurilopalonefauvel2843
      @joaomurilopalonefauvel2843 4 ปีที่แล้ว +1

      It depends on the regex flavor really. If I am not mistaken PCRE flavors do include non ASCII characters in character ranges. Even within PCRE there are many slight differences within engines though.

  • @MichielBruijn
    @MichielBruijn 4 ปีที่แล้ว

    25 years ago I made a meta search engine which stole the search results from another website in real time and presenting it to my visitors using regex.

  • @tigo01
    @tigo01 4 ปีที่แล้ว +11

    Just use vim, you’ll be a regexpert in no time!

    • @deoxal7947
      @deoxal7947 4 ปีที่แล้ว

      Why though or Emacs for that matter

    • @josephgaviota
      @josephgaviota 2 ปีที่แล้ว

      @@deoxal7947 Why use vi? Because it's so FAST to edit in.

  • @mishalubich7141
    @mishalubich7141 4 ปีที่แล้ว

    I wish you'd use conventional Regex, like the PHP and Java/JavaScript versions - compared to the fabulous first video, this was hard to follow.

  • @ropersonline
    @ropersonline 3 ปีที่แล้ว

    4:20: The [A-Za-z][A-Za-z0-9] expression as enlarged here is wrong. It's actually supposed to be [A-Za-z][A-Za-z0-9]*, as in with the asterisk.

  • @hereb4theend
    @hereb4theend 4 ปีที่แล้ว

    Awk, Sed, bash and grep walked into a bar... It was just Perl. 🤣😉

  • @SteveGillham
    @SteveGillham 4 ปีที่แล้ว

    Leaving the machine on Windows 7 to the very last minute 🧐
    Far better to have forward planning so you have time to put in a solution if there were problems.

  • @Reth_Hard
    @Reth_Hard 4 ปีที่แล้ว +14

    I LOVE Regex!
    but I hate it so much...

    • @FnordOok
      @FnordOok 4 ปีที่แล้ว

      My thoughts exactly. Doesn't help that there's different versions out there. (Ex: The version that Visual Studio uses is not quite PCRE)

    • @suicidalbanananana
      @suicidalbanananana 4 ปีที่แล้ว

      @@FnordOok YES!! regex are screwed up enough as-is, it really doesn't help that different languages have different spinoffs to make our lives even worse

    • @CrashingThunder
      @CrashingThunder 4 ปีที่แล้ว

      I love it when I've been absorbed into them for a little bit. The problem is that I only use them on rare occasions and have to get used to it again whenever I do...

  • @ahmedabushama4024
    @ahmedabushama4024 4 ปีที่แล้ว

    Wat about re with AI and deep Learning?

  • @user-zu1ix3yq2w
    @user-zu1ix3yq2w 4 ปีที่แล้ว

    I

  • @KillerSpud
    @KillerSpud 4 ปีที่แล้ว +1

    Regular expressions or regular headaches? amirite?

  • @WistrelChianti
    @WistrelChianti 4 ปีที่แล้ว

    I use them all the time... used two today

  • @kamoroso94
    @kamoroso94 4 ปีที่แล้ว

    I wanted to see what would happen with something like "1a".

  • @theawt
    @theawt 4 ปีที่แล้ว +1

    wow does the camera wobble

    • @NoNameAtAll2
      @NoNameAtAll2 4 ปีที่แล้ว

      i think it was handheld and stabilized

  • @Petertronic
    @Petertronic 4 ปีที่แล้ว +1

    Windows 7 is perfectly safe to use and will be for some considerable time. All the scaremongering originates from security software companies with vested interests in selling their products.

  • @pierreabbat6157
    @pierreabbat6157 4 ปีที่แล้ว

    Try "circue circls circuit circ".

  • @kishanmistry4385
    @kishanmistry4385 4 ปีที่แล้ว

    I just had a lecture today about regex in java coincidentally

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว

      How many classes does it take to implement a regex in Java?

    • @kishanmistry4385
      @kishanmistry4385 4 ปีที่แล้ว

      @@lawrencedoliveiro9104 2 classes/labs

  • @KX36
    @KX36 4 ปีที่แล้ว

    Just a little warning: Upgrading windows 7 era hardware to windows 10 is like upgrading a win 3.1 486 to win 95. Chances are the PC will be much more sluggish afterwards and you can expect windows update to completely brick your computer now and then. If you're going to use windows 10, it's really best in my experience to only run it on hardware newer than the OS. Just my opinion.

  • @kacperozieblowski3809
    @kacperozieblowski3809 4 ปีที่แล้ว

    I had no idea that Regex was meant for compilers.

  • @cynthiacavanaugh6458
    @cynthiacavanaugh6458 4 ปีที่แล้ว +1

    I now want to go fire up lex and yacc .

  • @guardiansunite5013
    @guardiansunite5013 4 ปีที่แล้ว +5

    Keep it on windows 7, you don't need the spyware upgrade.

    • @Son1cJ3t
      @Son1cJ3t 4 ปีที่แล้ว

      guardians unite the

  • @GregoryMcCarthy123
    @GregoryMcCarthy123 4 ปีที่แล้ว

    I always thought it would be cool if CPUs could have some special bus to process regex

    • @JNCressey
      @JNCressey 4 ปีที่แล้ว

      @@Ceelvain, maybe if you had a dedicated regex processor you decide if something matches in 1 cpu cycle.
      Perhaps it could even use a "reconfigurable computing" architecture. You could load your regex pattern into it, then use it as of it were a bespoke hardware checking for that specific pattern, for as many times as you wish until you reconfigure it again to a new pattern.

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว

      ​@@JNCressey You cannot match them in one CPU cycle. Regexes with backreferences are known to be NP-hard to match. So if you could match them with a number of CPU cycles less than exponential in the size of the regex, you'd have proven that P=NP and would win a million dollar.
      Even without backreferences, you still have to examine the whole regex and every character of your input string at least once. Therefore, matching a regex in a constant amount of time is just not possible.
      I mean, sure in some cases we could probably benefit from dedicated hardware, like a FPGA or just using GPUs. But these always come with a setup cost and a cost on each call. Basically you'd have to compile or otherwise prepare your regex for the device, then you'd have to send each input string to the device. So, in the end, you have to have a lot of input text to make it worth.

    • @JNCressey
      @JNCressey 4 ปีที่แล้ว

      @@Ceelvain, I mean if the dedicated processor had a much faster clock it could bring back the answer quicker than 1 cycle of the cpu.
      It wouldn't need to be constant time or processed below some number of cycles, it could just be a very very fast processor.

    • @Ceelvain
      @Ceelvain 4 ปีที่แล้ว

      @@JNCressey You'd still have to pay the cost of the setup time, and even with a fast co-processor you can't escape the algorithmic complexity. Even if the coprocessor is 100 times faster than your CPU, any string longer than 100 characters would be slower to parse than one CPU cycle.
      And I don't think higher clock frequency would be the way to go. The power consumption grows with the square of the frequency. And the thermal dissipation grows with the power consumption. There's a reason we reached a max CPU frequency of 5GHz 15 years ago.
      Besides, think about it. We already have algorithms that match regular expressions (without backreferences) in a time that's linear in the size of the input string. Meaning that each character is processed only once, and for each one, there's a constant amount of work to perform. In addition to that, the CPU will have to process every character at its own speed anyway. Should it be just to write the string in memory the first time. Therefore, the speedup you might get is fairly limited.

    • @JNCressey
      @JNCressey 4 ปีที่แล้ว

      @@Ceelvain, ok, cool.

  • @barefeg
    @barefeg 4 ปีที่แล้ว +1

    Why does the professor not use Linux?

  • @IllidanS4
    @IllidanS4 4 ปีที่แล้ว +12

    Moving to Windows 10 is not an upgrade...

    • @CaffeinatedTech
      @CaffeinatedTech 4 ปีที่แล้ว +2

      Yeah I feel sorry for him. I'm surprised he's not a Linux man to be honest.

  • @MrAlbedo39
    @MrAlbedo39 2 ปีที่แล้ว

    Most of the regex I've created has been write-only.

  • @kevinfontanari
    @kevinfontanari 4 ปีที่แล้ว +5

    Well, I guess the circus is officially a drawing primitive now...

  • @Sei783
    @Sei783 4 ปีที่แล้ว +3

    He's like the David Attenborough of computers.

  • @greyed
    @greyed 4 ปีที่แล้ว +1

    I'll be quite disappointed if at no time during the video are the splines reticulated.

  • @bobafruti
    @bobafruti 4 ปีที่แล้ว

    I was trying to do something with regex and... I was completely lost

    • @JNCressey
      @JNCressey 4 ปีที่แล้ว

      Did you try the multi-line option?

  • @Inkrementalgeber
    @Inkrementalgeber 4 ปีที่แล้ว +1

    Up until now I never thought about which operating sytem he is using because his talk is so interesting. But now that he brought it up I am kinda surprised he is using Windows. From what I have seen from him a unix like operating system would be what I expect him to use. Maybe he has work that can be done on Windows or just prefers to use Windows :)

    • @llearch
      @llearch 4 ปีที่แล้ว +1

      Maybe the university supports windows, and won't let him access particular services without it. :-/

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 4 ปีที่แล้ว +1

      @@llearch I’m not sure I would put up with working at such a place.

    • @thinboxdictator6720
      @thinboxdictator6720 4 ปีที่แล้ว

      I saw (open?)SUSE in at least one video with him ('The Most Difficult Program to Compute?') , but it could be because he needed to run a program for a month without interruptions..

    • @goahnary
      @goahnary ปีที่แล้ว

      @@lawrencedoliveiro9104 same but I'm afraid for his time in academia it wasn't possible because of how ubiquitous windows was. It's much more agnostic now but even when I was in college 7 years ago using a linux laptop required quite a few workarounds to access the internet and other silly and simple things like printing.
      Luckily the ACM at my school set up many things to help hack our way around this redtape like a facebook chat bot that printed files we sent to it haha

  • @ernstraedecker6174
    @ernstraedecker6174 4 ปีที่แล้ว

    Can't believe it. Nobody mentions Jeffrey Friedl.

  • @themellonchef7217
    @themellonchef7217 4 ปีที่แล้ว

    Today I failed my fundamentals of computer science exam because of regular expressions
    Now I have to wait another year to retake it

    • @themellonchef7217
      @themellonchef7217 4 ปีที่แล้ว

      In my defence I joined Uni only only a month ago and was unable to go to any of the lectures

  • @dwavenminer
    @dwavenminer 4 ปีที่แล้ว +1

    Regex, where rewriting is easier than editing...

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว +1

      Mostly true - unless you're having a) determined anchors everywhere & b) consistently use variables, parameters or constants to reuse (external) subexpressions - which is unfortunately not what most users of regexes do - nor do even all tools that use regexes allow for such things. Bother, said Pooh :|

  • @robl4836
    @robl4836 4 ปีที่แล้ว

    I had a problem, so I decided to use Regex. Now I have 2 problems.

  • @Chriva
    @Chriva 4 ปีที่แล้ว +2

    Windows 7 is EOL, Prof. Brailsford :)

    • @scragar
      @scragar 4 ปีที่แล้ว +2

      Still better than windows 10. So much bad design in win 10 :(

    • @Chriva
      @Chriva 4 ปีที่แล้ว +2

      @@scragar Geezus people have a hard time adapting. Ten is superior if you only take the time to LEARN it :)

    • @kestrel8838
      @kestrel8838 4 ปีที่แล้ว

      @@Chriva lol

    • @Chriva
      @Chriva 4 ปีที่แล้ว

      @@kestrel8838 It happens with every single release. People have complained about every new release since windows 98. Yes, people even hated xp in the beginning. Same goes for seven :p

  • @heliy_25
    @heliy_25 4 ปีที่แล้ว

    If C1 then D1.
    If D1 then C1 or C2.
    If C2 then D1 and C1 or D2...
    Or I didn't understand what the Professor was talking about. :)

  • @6754bettkitty
    @6754bettkitty 4 ปีที่แล้ว

    Next video should be on "sed."

  • @machitoons
    @machitoons 4 ปีที่แล้ว +6

    I wouldn't call win7→win10 an upgrade, personally...

    • @enterthekraken
      @enterthekraken 4 ปีที่แล้ว +1

      MachiToons - Machimations having a supported OS with patches is generally considered an upgrade. 🙂

  • @alanraftel5033
    @alanraftel5033 4 ปีที่แล้ว +3

    I used Lex/Flex to tokenize a programming language I've created at school, it was the best class ever. Creating a compiler for a custom programming language was fun, Now I'm developing boring websites :/

  • @me000
    @me000 4 ปีที่แล้ว +1

    4:3 gang

  • @Ownage4lif31
    @Ownage4lif31 4 ปีที่แล้ว +1

    I use regex for everything that I hate hehe

  • @user-vn7ce5ig1z
    @user-vn7ce5ig1z 4 ปีที่แล้ว +2

    😍 I love regex; I want to have its babies. (CSS is great too, but don't let regex find out about my mistress.)

  • @wyattboyer6540
    @wyattboyer6540 ปีที่แล้ว

    Imagine calling updating your computer to windows 10 from 7 an 'upgrade' lol. USE LINUX

  • @SumitKumar-tw4qe
    @SumitKumar-tw4qe 4 ปีที่แล้ว +1

    I will just pretend I'm smart.

  • @Gvozd111
    @Gvozd111 4 ปีที่แล้ว

    Bob

  • @hj45lp
    @hj45lp 4 ปีที่แล้ว

    ❤️ awk ❤️

  • @Satscape
    @Satscape 4 ปีที่แล้ว

    The Windows 7/10 bit...*Other operating systems are available. :-)

    • @Roxor128
      @Roxor128 4 ปีที่แล้ว +1

      Yeah, I moved to Linux rather than use Windows 10.

    • @FrankHarwald
      @FrankHarwald 4 ปีที่แล้ว

      & if you can't or don't want to switch to Linux/GNU, there's also React OS for most things.

    • @Roxor128
      @Roxor128 4 ปีที่แล้ว

      @@FrankHarwald It's been a while since I last tried ReactOS in a VM. What's the compatibility like these days?

  • @Pracedru
    @Pracedru 4 ปีที่แล้ว +6

    You should upgrade to Linux.

  • @elmo2you
    @elmo2you 4 ปีที่แล้ว

    Totally off topic: Is it just me or does the professor's skin color look a bit odd? Hopefully it's just me, or wonky color correction, because the first thing going through my mind while watching this video was: "I really hope that's not a liver condition".

    • @ChrisLee-yr7tz
      @ChrisLee-yr7tz 4 ปีที่แล้ว

      I thought he looked a bit I'll too.

    • @elmo2you
      @elmo2you 4 ปีที่แล้ว

      @@ChrisLee-yr7tz I hope it's just a wonky white balance or color profile/grading gone off track. I know we all have our time, but I hate the thought of professor Brailsford being ill. Let's just hope for the best: being scared by failing tech.

  • @YourTVUnplugged
    @YourTVUnplugged 4 ปีที่แล้ว

    Yea something's up with your auto stabilizer lately... Get a new one as they've never been quite this bad...

    • @YourTVUnplugged
      @YourTVUnplugged 4 ปีที่แล้ว

      It looks like someone's purposely jittering the camera back and forth... Yea it's that bad...

    • @YourTVUnplugged
      @YourTVUnplugged 4 ปีที่แล้ว

      Or like Professor Brailsford is holding the Camera! LOL but obviously not in this one since he's in the frame, not behind the camera! :P

  • @BassChopsBri
    @BassChopsBri 4 ปีที่แล้ว

    I think we need to talk about the elephant in the room ...