940 B
		
	
	
	
	
	
	
	
			
		
		
	
	
			940 B
		
	
	
	
	
	
	
	
title
| title | 
|---|
| Positive and Negative Lookahead | 
Positive and Negative Lookahead
- 
Remeber to use 2 lookaheadsto check the patterns in the string. The firstlookaheadis very similar to that given in the example - '(?=\w{3,6})' - only thelower-number3 is too low for our test cases, and anupper-numberis completely unneccesarry. This firstlookaheadis only used to find a string consisting of a certain amount of characters. A secondlookaheadmust be used to check for consecutive numerical values at the end of the string.
- 
The second lookaheadis also similar to that given in the example -(?=\D*\d)- however, this expression too must be modified to pass all test cases. Remember to specify the exact amount of numbers you want to appear at the end of the string.
Solution :
let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(?=\D*\d{2})/;
let result = pwRegex.test(sampleWord);