WEBVTT

00:01.440 --> 00:04.680
Okay, now we just, uh, done the first tip.

00:04.720 --> 00:07.320
Okay, let's execute and read ifconfig.

00:07.320 --> 00:09.000
We are able to read the ifconfig.

00:09.160 --> 00:09.560
Okay.

00:10.040 --> 00:15.280
And now it is time to read the Mac address from output.

00:15.320 --> 00:15.880
Okay.

00:15.920 --> 00:17.040
So where is the output.

00:17.120 --> 00:17.920
Let me show you.

00:18.040 --> 00:19.880
This is the output okay.

00:19.920 --> 00:22.120
And this is the Mac address.

00:22.160 --> 00:22.560
Okay.

00:23.480 --> 00:28.560
So how can I capture only the Mac address and read this.

00:28.600 --> 00:29.400
Okay.

00:29.440 --> 00:30.680
There is something.

00:30.720 --> 00:30.920
Okay.

00:30.920 --> 00:38.840
There is one thing, uh, something or one thing that is called regex or regular expression.

00:38.840 --> 00:43.760
You can use it in any programming language, but in Python we are going to use it and you are going

00:43.760 --> 00:45.120
to learn it how to use it.

00:45.240 --> 00:54.480
There is a website called Politics and politics.org.

00:54.520 --> 00:56.400
When you can write in here okay.

00:56.920 --> 01:02.480
And you're going to see something like this, you're, you're not going to see this one and you're going

01:02.480 --> 01:03.640
to see something like this.

01:03.840 --> 01:04.840
Okay.

01:04.880 --> 01:08.330
So here if you add something, anything.

01:08.370 --> 01:08.730
Okay.

01:08.850 --> 01:09.810
Your test here.

01:09.970 --> 01:15.050
Your test string here in this part and your regular expression here.

01:15.370 --> 01:17.290
And the result will be shown here.

01:17.770 --> 01:21.770
And also regular expression cheat sheet also here.

01:22.210 --> 01:24.610
So here we have very good description.

01:24.690 --> 01:30.850
For example if you want to use dot at the beginning or anywhere it is going to match any character okay.

01:30.890 --> 01:33.610
Any character that means all characters.

01:33.850 --> 01:39.850
And if you use alphanumeric, if you want to find alphanumeric, that is something we are going to use

01:39.850 --> 01:40.130
here.

01:40.170 --> 01:41.050
Okay.

01:41.090 --> 01:46.850
That is included from 0 to 9 A to Z and also A to Z and also underscore.

01:47.570 --> 01:51.730
So we are going to use a slash w okay.

01:51.770 --> 01:53.930
This small one not Capital One.

01:54.730 --> 02:01.250
So let's come back here and let's select our ipconfig result okay.

02:01.290 --> 02:03.770
I am going to select everything from here.

02:03.770 --> 02:06.130
I'm going to copy selection.

02:06.130 --> 02:12.130
And then I'm going to go to browser here I'm going to paste that.

02:12.330 --> 02:17.100
So I use control V so now it is pasted.

02:17.420 --> 02:20.580
So here let's hit dot here.

02:22.500 --> 02:24.700
And this is the matched result.

02:24.700 --> 02:26.620
As you see right now it is selected.

02:26.620 --> 02:28.580
Everything okay.

02:28.620 --> 02:29.980
It is not what we want.

02:30.020 --> 02:33.580
So what we want is the Mac address.

02:33.580 --> 02:34.820
Where is the Mac address.

02:35.220 --> 02:36.300
Let's find that.

02:36.940 --> 02:39.140
So either this is the Mac address.

02:39.140 --> 02:42.620
As you see this part is called Mac address okay.

02:42.660 --> 02:44.220
So we have two number.

02:44.620 --> 02:48.420
And then we have this called alphanumeric okay.

02:48.460 --> 02:50.860
So we can use this part okay.

02:50.980 --> 02:59.700
Slash w alphanumeric again alphanumeric alphanumeric alphanumeric alphanumeric and alpha numeric here

02:59.740 --> 03:00.300
okay.

03:00.340 --> 03:04.180
And also we have to use colon as well here okay.

03:04.220 --> 03:07.060
So let's do that here.

03:07.060 --> 03:10.820
For example I am going to select a slash w.

03:10.860 --> 03:14.780
That is something that is looked there okay.

03:14.820 --> 03:22.710
So as you see it is it's selected all the numeric and also all the alpha alpha numeric alphabet and

03:22.710 --> 03:23.830
also numeric.

03:24.110 --> 03:27.070
So it's selected all and everything.

03:27.070 --> 03:28.550
I'm going to use it again.

03:28.950 --> 03:30.390
Slash w.

03:30.390 --> 03:36.230
So right now it is again selected alpha and numeric numbers and alphabet.

03:36.270 --> 03:41.030
So here as you see it is not selected the colon.

03:41.030 --> 03:42.870
So let's use colon here.

03:43.790 --> 03:44.310
Wow.

03:44.310 --> 03:45.790
This time it is better.

03:45.830 --> 03:46.430
Okay.

03:46.470 --> 03:52.870
Right now you see that we selected alphanumeric and we haven't selected the last one maybe.

03:54.310 --> 03:58.790
And that is because the at the end it doesn't have colon okay.

03:58.830 --> 04:00.150
Because of that it is happened.

04:00.190 --> 04:02.190
It doesn't selected that yet.

04:02.230 --> 04:04.590
So what is the solution.

04:05.110 --> 04:05.310
Okay.

04:05.350 --> 04:08.790
We have 123456.

04:08.790 --> 04:16.630
What if I select I use backslash backslash WWW6 time.

04:16.630 --> 04:19.070
So I'm sure it's going to solve the problem.

04:19.110 --> 04:19.350
Okay.

04:19.350 --> 04:21.110
Let's go and do that.

04:21.150 --> 04:23.350
Okay w slash w and then colon.

04:23.470 --> 04:31.600
Slash w w So now you see we have selected these three, four, five and six.

04:31.600 --> 04:33.720
I'm going to select that six times.

04:33.840 --> 04:39.440
Slash w w w w w w.

04:39.440 --> 04:46.000
Now as you see it's selected only only the Mac address okay.

04:46.040 --> 04:49.720
The ether as you see that here right now it is this one.

04:49.720 --> 04:55.760
If it if it has for example alpha alphabet again it's going to select it.

04:55.800 --> 04:56.800
No problem.

04:56.800 --> 05:00.040
So now this is our regular expression.

05:00.040 --> 05:01.760
We are going to use it with Python.

05:01.760 --> 05:11.080
And if someone trying to learn other programming language like Java or even JavaScript, they can use

05:11.120 --> 05:12.400
the same thing.

05:12.400 --> 05:19.480
So right now we provided a regular expression to select only the Mac address from ifconfig result.

05:19.480 --> 05:26.880
And let's go and see how we can use it to extract this from the output.

05:26.920 --> 05:27.320
Okay.

05:27.640 --> 05:31.480
So let's go and do that in the next lecture.
