Placeholder Image

字幕表 動画を再生する

  • so wild cards.

  • So he's at the classic example of this is your You wanted to list files and you say I want to find all the word documents on my system.

  • So if you have a command line prompt on Windows, you would say something like D I r star dot stocks or Doc Ex.

  • Something works in UNIX.

  • You could do less star dots, doc checks, and then the output you'll get.

  • There is a list of all the files that end with the extension started.

  • Doc Ex.

  • So what's going on here?

  • How does this actually work?

  • We generally talk about wild cards only thinking about files and things, but similar things.

  • They're used in other places.

  • So it's all about in fires.

  • That same approach could be used elsewhere.

  • So what A wild card is just the idea that certain characters, rather than being compared literally against the actual file name or the directory name, are interpreted as having a special meaning.

  • So the obvious one is star, which means anything we tend to think about is anything.

  • So what we're saying here is show me all the files D i r less dependent on using docile Lennox.

  • All the files is anything dot Doc ex.

  • So what's actually going on here?

  • We're expendable.

  • Think about the different wild cards we get because there are various things.

  • The two main ones you come across.

  • Oh, star, which means match anything on you.

  • Get a question mark.

  • Which means match any character.

  • So, for example, if we wanted to find all the letters thio mothers than we might do a search for question while m dot doc ex, that would then find Mum Doc X, and it would also find mom dot doc Exit would also find ma'am that Doc ex andi would find em three dots doc back.

  • So it'll match any character instead off the question mark.

  • So it's basically saying at this point, I'm not gonna specify what's here.

  • You much any character.

  • You could also combine these so you could search for M question mark.

  • Question What m dot doc x, which, of course, won't match any of these because it has two characters there but would match for example dot dot X like that.

  • Imagine something like that because it's to their.

  • And again this could be M won four m dot dot x Or if your hacker you might have dot doc ex etcetera.

  • So what does this actually match?

  • What about star then?

  • So start means match Anything on this watch the various slightly between windows on UNIX or something between dos and you look so, for example, that say we have pre and then we match that to star dot doc.

  • And so this would match prefix dots, doc.

  • It would also match prepare dot stock, etcetera.

  • So anything that begins with P r E, it'll match there.

  • You could do star i x dot doc, which would then match suffix dot doc and equals UNIX dot dot because he's mean anything that we match here.

  • And then we will find I x dot dot The style's meant any run of characters from zero arm or this would also match.

  • Of course, I x dot doc on this would have matched pre dot doc and things because it's basically zero Maur.

  • Any counters that we like, you can get slightly more advanced one.

  • So UNIX allow you to do something.

  • Let's have a look.

  • You can say a dash zed in square brackets file dot doc, This is getting UNIX would allow you to match a file dark and even writing t file dot doc.

  • But it wouldn't match Refile Doc, because what we said here is a match.

  • Any characters between uppercase a an uppercase said.

  • So this is a lower case Be so this wouldn't match.

  • Where's the Wood?

  • So that's basically what wild cards are.

  • How's it do?

  • So how does it do that wasn't looking.

  • Imagine you got I've got a list of files literally going for every file going.

  • So if you think back we talked about that.

  • He watched the video on zero size files.

  • We talked about how Computer has a directory off all the files in it.

  • So let's just create a simple directory.

  • And let's say we have Let's just say we have lecture 01 lecture 02 We have lab to see her when you can tell what I've been doing this week.

  • Lab zero to, and we've got a file cord notes in there.

  • And so these are all separate Father, these air in the catalogue for the current directory.

  • So that's why I wanted to match all the lectures.

  • Well, then I could use a wild card or lecture star to match all the lectures to how that should be matched against each catalog.

  • Well, that's let's first.

  • Well, let's see how it would do it if we just specified an actual file name.

  • So what would happen if we wanted to search for Lab 01?

  • Because it's a bit further down.

  • So what to search for the file lab?

  • Is there a woman what actually happens?

  • Well, it's gotta find whether that's actually your file in the directory or not.

  • And you have You have a series of a P I cause and the operators and allowed to search through darkness.

  • So what's gonna happen?

  • We're gonna come to the first file under the directory.

  • So we got lecture 01 on.

  • We've got Lab at once.

  • We're looking for the Fire Lab.

  • One on the computer's going to compare the two characters that's going to compare Alan L.

  • And they match and it's not going to compare E and A they don't match.

  • So we know that it doesn't match this one.

  • We don't do the same for a lecture, too, because it begins the same way we get to the same point we then come to compare lab 01 on lab zero.

  • Once we're looking for Fire Lab 01 would come toe catalog entry, have 01 So we compare the 1st 2 characters that they match.

  • We compare the 2nd 2 characters they match.

  • We compare 30 characters.

  • They matter, Should we compare last but one characters and we compare the last two characters and they match.

  • And so we found the file.

  • It would actually then keep Gary and compare.

  • We've left there, too.

  • And they would not match on the last character.

  • And so it wouldn't match on the same for notes.

  • And then he would finish.

  • So what?

  • The first thing we do is we check every file in the capital of each time we do it.

  • You could probably build a persistent and in place to make it faster.

  • Whether they do that, another is an implementation.

  • We weren't going to that.

  • So how do we handle the wild card?

  • Well, let's think about traditional window style where we just mean anything that follows will match with the star.

  • So let's say we're gonna look for lecture again.

  • It will do the same things to researching the catalogs or a lecture.

  • 01 And we're gonna compare this with lecture star.

  • So we compare the 1st 2 they match.

  • Compare the second too.

  • They match compare the third too.

  • They match and so on.

  • Until we get to this point, they've all matched.

  • If any of these didn't match, that would stop because they don't match just like we did before.

  • They're now in the windows Dos World star means anything after here matches.

  • So as soon as we get to this point and it's a star here, we say, Well, okay, it doesn't matter what that is.

  • We've matched.

  • This is a big tick.

  • We can use this file, do the same.

  • Electra too.

  • And of course, the same thing happens with the others.

  • When we get there, it doesn't match and it carries on.

  • So it builds a ballistic results or you have things that you can go through to reiterate through them.

  • And so when you get the first and you get the next and the next and the next to become to the end, interesting point is where is it's actually done in the system, and that depends on the musings of using a UNIX system.

  • This is often done by the shell.

  • So actually, when the program gets called, it actually gets called with each of the different files.

  • Different arguments passed into the UNIX execute a ble to save him to do it itself.

  • So because you can see how this would then generalize with, say, the question what?

  • When we come to the question what?

  • Let's say we're searching for files match lecture zero and then some number like zero for Well, let's say we use the pattern lecture.

  • Is there a question mark?

  • We compare each of the just as we did before they won't match.

  • And when we get to this point, we see that this is a question mark on we, right?

  • The Coast is no question Mark that matches with anything.

  • Of course, this wouldn't match with the file lecture file name, lecture zero, because we'd have the question mark here, and this will be the end of string and so wouldn't there.

  • So we just have to write this string comparison algorithm to know about question walks and to know about stars and the other character codes that we can use to represent other things plausible when you actually read into the comet's thereby bizarre Let's pick a couple in cirrus eso eso this guy by blocking flop.

  • Now that might be a real person, but probably is just a completely made up user name.

  • I was no pretty puzzling the code gaming so they would have found out something tread.

  • The largest stop information that this guy has a lot to hundreds replied.

  • I find your own difference profound.

  • Certainly.

so wild cards.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

ワイルドカード - コンピュータマニア (Wildcards - Computerphile)

  • 10 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語