I need help to understand the whole thing

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36.

Challenge: Positive and Negative Lookahead

Link to the challenge:

You’re going to have to be more specific about what you mean about the “whole thing”. In general, very specific questions get better answers, both in quality and quantity.

l need to understand the answer written


This is a regex that checks whether there exists a letter or underscore, followed by a number.

PS because it’s made up of only lookahead assertions, when passed to the string method match(), a successful match will return an empty string i.e. "".

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.