Regular Expressions - Positive and Negative Lookahead - Free Code Camp

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

The lesson as been changed and or updated Mr. Ian this is the new correct answer below:
let sampleWord = "astronaut";
let pwRegex = /(?=\w{6})(?=\D*\d{2})/;
let result = pwRegex.test(sampleWord);
console.log(result);

zken
Автор

hey man are u explaining to us or understanding yourself

hasnainAliDev
Автор

i came to this video because i was confused.
now im more confused

emilyrushforth
Автор

Thanks for very halpful videos. It really helps to see how you are getting to the logic, thinking loud.
In this example I was wonder if we should use {5, } for sure, but than I saw it passed anyway the tests without.
So just to check the consecutive numerical values in the second lookahead is doing the same thing.

like
Автор

anyone I need some explanation about this one ' \D* ' what's the purpose of that if we provide a ' \d ' after it? I'm confused looks like contradicting since its opposite to each other and stored in the same parenthesis ??? I NEED HELP PLEASE freeCodeCamp did not explain it well and the freecodecamps solution too has a ' \D* ' HAHAHAH what happened???

icaruz
Автор

2:10 I get confused why you said OR at this part, shouldn't it be AND because the regex statement checks for both conditions?

json_n
Автор

thanks for going over the example questions throughout these ffc modules it really helps break down the logic! :D

nhiemtran
Автор

The minimum length ( 5 char length) of the passcode is not met either

niranjanamurthy
Автор

Thank you, your videos are super helpful

tungvuongtri
Автор

Shouldn't we add case for password having length 5 atleast?

simpleman
Автор

i am using (?=\w{5, })(?=\D\w\d)/; but all in vain, the only error is """"Your regex should match please help me out.

atifnasimkhan
Автор

I think RegEx pattern have changed for the same problem. Now it asks us to have a minimum number of characters

karthikjmoger
Автор

I think you need to understand the concept before you make a video. Your explanations are extremely confusing.

zerocool
Автор

\D is anything that isn't a digit- like alphabets, newline, whitespaces etc.
and \d stands for a digit. Your video was good but you are saying \D and \d are used for digits, that's wrong I beleive. Both have opposite uses

krishchait
Автор

Never ever ever ever ever ever ever read a slide to an audience.

DanielBrownsan
Автор

did anyone else notice that it was on a local host

nakulankurmullam
Автор

let sampleWord = "astronaut";
let pwRegex = /(?=\w{6, })(?=^\D+.*\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);



THIS IS MY SOLUTION, BRO, YOUR CHARACTERS MUST 5 OR MORE AND YOU DID NOT ADD IT.

dironizareyes
Автор

Interesting to see different solutions, mine differs slightly:
let sampleWord = "astronaut";
let pwRegex = /(?=\w{4, }\d\d)(?=)/; // Change this line
let result = pwRegex.test(sampleWord);

maciejdev