2.2 Character Classes: Words, Digits, and Spaces - RX
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
Welcome back to the several introduction course to read IX. I'm your host, Kevin Hernandez. Today will be going over a lesson to off our second model, which will cover words ended its inside regular expression search parameters.
00:14
Let's go back to Reddick, sir.
00:16
No, here. Half a couple of numerical strings. As long as the word strings.
00:21
Now.
00:22
Well, you're talking about word digits and white spaces,
00:28
right? Everything click here like we learned of previous lesson. You could match anywhere, character, often America, or underscores. So
00:37
if I also right,
00:41
Captain Hernandez, what underscore? You can see that it's also detected.
00:45
Now, if you're paying close attention,
00:52
you see, it's a lot of small squares. It means it's detecting one character at a time. If you're bailing out rejects again, be careful
00:59
because in here you will be detecting neither That want the 234 or five or six right instead of the whole sequence of numbers here.
01:07
So how do you fix that? Is with qualifiers
01:11
right down here
01:12
for one to take at lease
01:15
one or more characters a cave
01:18
the plus sign,
01:19
which is very common,
01:21
commonly found here with, uh,
01:25
rednecks. All right, with the doubly in the d basically means yes, if it there's a least one character. I want to find the sequence.
01:33
Now. If you look closely, you can see them now instead of being a lot of small squares. It's a
01:38
big, solid block of numbers, and here, very similar. Again. You will see the slash the dash is here that broken up. So obviously it's not
01:47
that good if you wanna put it that way, but in here you will have four sets instead of one
01:53
from there, for you will have to write to secrets a slightly different.
01:57
Now you can see the text numbers and words, but just because it works for both doesn't mean you should use slash W for both. If your child go just for digits, it is actually more efficient to write slash tea and you can see now it will be detecting on Lee the numbers again if you now see carefully one or more
02:17
detecting one here,
02:20
right?
02:21
So what about if I want to detect if there's let's say
02:27
zero or one,
02:29
Okay, But how does that work? I mean, if I just do this,
02:32
nothing change. Well, it does, actually,
02:36
because, actually,
02:38
if I start writing Kevin,
02:39
right? Sorry.
02:45
Right.
02:46
You can see it. Detective Deaths. This one, right.
02:50
And this one? Why? Because it looking for if it's a numbers there are not there.
02:55
Right?
02:57
And therefore, this is a number.
02:59
Danny goes like it's there. Now, if I, for example, switched that
03:02
seer or one to a plus,
03:06
you can see that only now it detects the one that has at least one number in the sequence
03:10
bore.
03:14
If I go back here again, right,
03:15
and I do 11.
03:17
All right.
03:19
Such back to
03:21
So you're our one. You can see now They want asked to. Numbers is not detected. Right?
03:25
How about the store?
03:29
But the star actually would look
03:30
regardless if it's has or doesn't have the number, and therefore it will detect all the sequences.
03:36
So you see, it's it's very important you learn how to use this qualifiers, because otherwise you'll be doing the incorrect heretics.
03:49
Now,
03:51
let's go over words. Right,
03:53
spaces.
03:55
So here you have Captain Hernandez
04:00
put it all together, You see? Okay.
04:02
Oh, it doesn't take the top one because there's a white space. Okay, I can put a white space manually.
04:09
True,
04:10
we reckon. Also
04:12
put it like this. All right, that was The difference is,
04:15
if you don't know how many white spaces they're gonna be, you cannot be gassing, right.
04:19
So let's see, It has to
04:23
Let's say that has three, right, because he likes to lick, lick some little thoughts in there and symbolizes how many spaces are. So if I try to do this, they're gonna go. Oh, space.
04:33
Oh, there you go. It work again, Depending under Reddick stole. That might not work. So it's always safer to use the white spaces. A such
04:43
now here we go like, OK, so there's a once one space right
04:47
here. I will deal with the question mark. Right, So you are one. I will detect the one that has no spaces or one space
04:56
painting with a plus. Here All the technique has one space or more, and therefore this one's not selected.
05:02
And again,
05:03
that's no digit numbers.
05:05
Example
05:06
here I will detect if it has
05:09
any number of spaces or no spaces.
05:13
Again works both put words and with numbers.
05:16
Now you're probably thinking
05:19
Oh,
05:20
but how about not word or not? a number. Oh, pretty easy.
05:28
Listen, not space, right?
05:30
Oh, guess what? Now those at spaces are not detected.
05:33
Therefore, they want to have numbers or on their scores or a special character, even. Right? If I, for example, go here
05:42
and right up Sorry,
05:45
right. A special character. That's not
05:47
that's it. Bye slash W
05:48
All right. He will still be detected
05:54
again.
05:55
This is what records is built in. You're not sure what is in there, and you can still find it,
06:00
all right.
06:00
And this is how not worked. And I guess slush, as is the best and East is example to show how this works.
06:12
No, we have basically scene
06:14
more or less, right,
06:15
what's what and regarding words. And it's you know, that words will the checking digits and underscores.
06:24
But even so, it's better if you're just looking for numbers to use the slash digits function. You already know how to use the qualifiers and inter nations of zero or more One or more RC or one.
06:39
And as we go over, you will start to grasp these segments. This might look really simple, but it takes a lot of it a practice to understand which quantified to use properly. You're finally getting the graphs of this, and as we move forward, it will be easier and easier to understand rejects. If you have any questions, don't hesitate to contact me.
06:58
I'm here to help.
07:00
Have a great day.
Up Next
Instructed By
Similar Content