2.5 Length of Queries and Mixed Examples Continued - RX
1 hour 37 minutes
So welcome back, and we're gonna take off where we left off in the last lesson. This is still part of the land quarry lesson. It's just that we're gonna expand in this little concert over here.
And not only that, we're also gonna be at something that does not appear in the cheat. Cheat. Okay, So again, like in the previous example, we're gonna be using numbers
as it is easier to explain
these type of concepts asked, You are learning.
So here I am, actually expanding numbers off different lengths or sequences off numbers.
And here we have up to 12
up to 15
her 16 whatever.
And then we have up to 20.
again, we're gonna be using digits,
right? So slash D if you remember correctly from here
within the little breakfasting.
if you remember correctly for one to detect exactly three,
we just type three. And in Texas, you can see a block of three.
One block of three and an additional block of three. And nothing. Nothing. And then three blocks of three et cetera. Right? So what if you want to the tack At least three characters or sequence that has at least three characters. Right. You're more.
Then do you actually do
And if you see correctly here,
C two or more in this example two or more so three or more and you see it targets 12312 before a Terrebonne, it does not target one, nor 12 or 12 if you want to put it that way.
So what does this tell me?
Basically, what it tells me is
I want to say specifically, search for parameters of a precise starting late.
Are you trying to follow now where this might be heading?
If not, I'm gonna give you a couple more examples right
What happens if I put them by his versa will be detecting from
up to three characters.
if you're trying backwards, you know it's not that friendly. So you actually have to say for example, 123 So you can see again block of threes, right
between one and three.
Or you can say, for example, syrup did three and again you see a warning.
This Russian can return empty matches. So you gotta be careful.
It will be equivalent off when you do the little exclamation mark, which here or wonder. So in this case, at least two of the three you gotta be careful.
So again, there's the coven off that 123
segment, but again
different than the D three right where it didn't detect one or 12. In this case, it does Detective Curtis a minimum,
bracket or sell off three characters. So to think about this, compare it to a let's, say, a roller coaster ride of coral culture. You match at least up to three people, right, so you can fit one person. Maybe
you could fit two people, or you can feed three people, right? And that's little roller Coster card, right? But more than that, then you have to have a second court right up to three people and then 1/3 card, etcetera, etcetera. It's a good way to think about a right little blocks of numbers.
if you see carefully here, we're now into a different concept. We have 12 or up to three,
and that's literally the last concert. When it comes to this, quantum fires fragments right. In this case, let's say you want to see if It has at least three characters and up to 10 characters. And you can see then that these ones are detected,
right? And if you play close attention different than when it was three comma, right?
You can see that this is divided just here after the 10 digits. Right? So if you do this,
it's one block.
If you did this,
it's two different blocks again. Think about the little roller coaster cards right
now. How can I use this?
You getting an idea yet or not? So let's say your information security analysts are a PSA sentiment, and you're in charge of blocking or protecting the environment for malicious evils. Right? And you start receiving an email
process invoice, right.
And then it has a couple of numbers. Right?
Let's call you that.
Here in this pound.
123456789 Right. Just to make sure you see how many dates are in this scenario, you know,
the first time you see the first email, you literally block it a such
but ask you moving forward, you start noticing that the last digits
and it becomes a sort of a sequins
they start expanding,
and at the end of the day there's actually no formatting. It's just
It's in this case is when you start doing the whole
projects that we discussed in the prior lesson, right?
I want to be exactly nine characters
or 10 characters.
or eight characters doesn't really matter
now, as you can see, even though its less characters it was still detected.
Why is that? It's because, as mentioned earlier lessons,
they're missing a perimeter at the end, which you need to take into account.
So if you want to lock specific subjects such as invoice right
this and that has urgent
in the subject,
and all of them have the argent on it. You want to make sure
you include that urgent aspect into your rejects in order to capture. And, as you can tell now, none of them match. And that's because it's eight and not 10 again. This is all materials, just reviewing it really quick.
Now, if you do 8 to 10 you can see all of them are detected.
And if I, for example, again, let's just discuss
earlier part of lesson
weaken ranges and it's perfectly okay. Now let's see. Your company uses a very similar format for invoicing, Right pound.
It has a date
in this case, this one, right?
And then he uses one initial and it has, let's say the letters, right. One,
So what happens Here?
It is the following
You want to make sure Daddy, for example, the malicious person. It's using words in here as well.
I would say they have a I somewhere in here
or something to have a P
right. You want to make sure
that you're, uh,
format. It's not also block. So in this scenario, right,
if we block invoice space, pound
that's a w
plus Right? So just to make this easier
Urgent to space of dire. Sorry
that you can see that everything's detected. So how can you work with this? Well,
in this case, you can either work creating an exception for year format, or you can work to creating a specific block for this, right? So in this case, you know that your company has a specific length
and they always have the initial after these date range, right? So let's say we're gonna be working on the white listing, So instead of using the slash w right,
we're gonna be trying to detect these characters here. In this scenario, it's five right,
two for the month, one for a day into for the year. Now what happens if it's, um,
in the year? Then, in that case, you'll have four characters, right?
So four characters. And what happens if it's December 20th
2018? In that case, you'll have six characters, right?
So you going to slash six,
Something is that you have to have a letter right
now. In this scenario, if it's a small company you can actually use used to square bracket, and that's a put
being a cello, the sales person, right?
And then you can just do, uh,
let's say I want to tend to make it easier,
in the space and the urgent. So in this case, actually has more than 10.
Let's say 15.
There you. So in this case, this works, but it's not efficient.
In a recent being, let's say you have self political Kevin than you have jae soon to have Brian. Do you have Theresa and you will he to have working on this often and whatever and employee leaves, You have to update it and tell her right
now you might be thinking, Well, that's easily solvable If I use W one. I mean,
it's one letter, so it should be taken care of, right?
Doubly. It's alphanumeric. So what do we have to do to fix this?
And why do I put a to C eight to see twice again?
It's case sensitive, right?
And not only that, it also, uh
or remember 18 this year it's an order. It's a range from A to Z and minor and eight to seen upper caps. Right
now. Why is it still being detected Because of the data? Right Here you have 343 whatever. And here you have a lot more. So, for example, you actually then have to fix it.
Mission at length.
Well, for a range of characters.
And there you have. You built it. You're making sure you're not detecting all these characters like earlier because you were using any off on the merry character, and you're basically working through it. And this is when tools like this come very helpful. Thes tools help you start working and troubleshoot your
Rogic's while you're building them
live, and therefore minimize the amount of Amherst you might bring into your production or test environment.
And even though you still have to be cautious once you put them in your environment, do you at least have a general idea of one minor changes you might need to make, like simplicity?
So in summary on this model, we discussed the following parameters off the Reddick structure. How did use words
while cards ranges
and the length of the queries helped to basically tell the rhetoric
how far or how short the Syntex gonna be right? The search parameters are going to be
We have a great day. I'll see you in the next lesson
The OWASP Online test is a premium Cybrary assessment test created by iMocha. It is ...
Assess your Regex skills with Cydefe's capture-the-flag (CTF) style skill assessment.