Regex

Course
Time
1 hour 37 minutes
Difficulty
Beginner
CEU/CPE
2

Video Transcription

00:00
welcome back to the introduction course to read tricks. I'm hearing structure Kevin Hernandez
00:06
on a prior lesson. We went over when to use rednecks.
00:10
As you remember. It was not always the best option.
00:14
Sometimes Raj ICS might break things right. And just because you can use it doesn't mean you shoot. If there's no patterns, you might as well better off right. The complex it's intact itself. No rejects, no nothing. Just the string of characters to stop. Drink the payload, a tinkerer.
00:33
Always remember. Simple. It's better. It's always better to write
00:36
multiple simple Reddick's is over a complex one.
00:41
Now let's move on to model to Lesson one.
00:44
The reject structure
00:47
for it is a lesson, as we have in prior lessons, will be using magic, sir.
00:51
Now,
00:52
one of the things I like from rejects her issue have different options here,
00:56
right that you can start using for creating your Reg X right.
01:02
And one of those is cheap.
01:04
Now you can use a cheat cheat like looking here in the side, and you're gonna actually click on them and ask them here
01:11
on the expression, as you can see,
01:15
or you can actually highlight
01:19
whatever its written, and he will actually be telling you
01:22
what each of these perimeters ISS
01:23
now if you see print is your capture group, and you can see that if you go down here, capture group. The press square bracket is a character said. As you can see here,
01:34
um, here from A to C Capital A to Capital C. It's character between us. You can see in this expression over here
01:41
the slash W. It's basically where any often American character or on their score right,
01:47
and the plus means it's one or more, you know, from first in instant you think. Oh, so this is detecting a word that starts with a capital letter. But
01:57
if you evolve it a little more
02:01
right,
02:02
you can see that it's not necessarily
02:07
the case.
02:08
Missing what happens is
02:10
as long as they're one character is capitalized. It doesn't really matter what is following in ah,
02:21
or prior to the character. It will still detective right?
02:30
See,
02:31
now what is it looking for?
02:35
If you remember, there's also a capture group, so it's not detective, even though it's detecting the whole word.
02:42
It's not capturing the whole word. If you're using this into s I am, for example, or any
02:47
coating, it will actually go towards Differs Letter on the group from this case, it will cover the are in here we capture the E and here it will capture the l
03:00
appeared a the eye
03:04
the A
03:05
Right now what happens if you do? For example,
03:09
Triple A.
03:12
Well, the red bricks works from left to right, so
03:15
it will capture the first, eh?
03:17
Now it's confusing because obviously I choose the same letter to three times. But if I do a b. C, you will pick a
03:25
Now what if I want to do capture the whole word? Well, if that's the case, then the capture group right, we'll have to go.
03:35
In the end,
03:36
he will capture the hole where that starts with a to Z.
03:39
Now what if I want to capture whole words
03:44
that don't start with capital? Then you have to change the capture routine. Non capitalize,
03:50
right? And
03:52
if you notice this little minus sign here, it's specially arranged. So if I eliminate that right, let's go back to a Z capital.
04:02
You can see that now it only detects if the word starts with a capital E
04:08
or
04:11
Couple Z and apologize, not starts with contains the capital Z
04:15
not. What does this mean is
04:18
You gotta be careful because you cannot just take assumptions and pretend it's gonna work.
04:25
You have to be careful when you're building this, especially if you're gonna put it in a production system.
04:31
One of the things I like to do is test my radic sis. Here I will test them in extraction, putting an expression pain.
04:41
And after that I will, for example, right into payload, a copy pace of payload from my application. Let's let s I and the deal p and then I'll test it here and see if it works. After that,
04:53
some tools offer a red X test.
04:56
You're building them. I will test him in there. And the reason being like extent in the prior lesson, just because it works here on this website doesn't mean it's gonna work in your tool. Okay,
05:05
now
05:06
there's different parameters here, for example, like you said, the S W. It's often Merrick ditty. It's only digits and assets, white spaces
05:16
from there, obviously the opposite. It's not words not did just not white spaces.
05:23
You have special characters to escape him. So any character that could be, ah, wild card or a, uh,
05:31
sheer orm or or again
05:33
a slash right he will have to break the character. Otherwise, for example, from trying to take,
05:40
uh,
05:41
slash W you actually comes again the perimeter. Any work character.
05:46
However, if I want to capture, let's see
05:50
D's, for example, if a subdirectory path right,
05:55
then I will have to break
05:58
that character,
06:00
all right, I'm not sure. Let me write it
06:03
as such.
06:05
What?
06:09
And that's why you have to be careful, not It's not written
06:12
little by little exact match. You have to understand that that parameter right
06:24
now what they will learn today, we went over a brief overview of what the parameters are always putting slash w capture grooves all the different things that will explain in more detail in future lessons. We also work with the default projects that it's built in, reject, sir
06:40
and basically stated that east detecting or capturing
06:46
the first capital letter in the word
06:48
or in a set of characters again. If you do a one, for example, it will be capturing the A in a one.
07:00
On our next lesson, we will start going over the character. Sir, it's
07:03
composing word. Digit in space is right. The first letter and the cheat cheat. I hope to see you soon. Have a great day.

Up Next

Regex

In this course you'll learn the basics of regular expressions, also known as Regex. As a professional you will understand when it is beneficial to use Regex and when it's not, how to construct Regex, and how to read Regex built by other professionals.

Instructed By

Instructor Profile Image
Kevin Hernandez
Instructor