Tell us what’s happening:
so are you making sure it begins ^ with a digit and ends with a digit$
Your code so far
let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/; // Change this line
let result = reRegex.test(repeatNum);
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.
Challenge: Reuse Patterns Using Capture Groups Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
what’s the question you have?
I tried this in codepen and sure enough it didn’t work. I’m going to try to solve this. What was it supposed to be again?
Im testing it on console and its weird
everything works but nothings showing up
it might just not be a complete code
Thats the answer provided which passes the challenge. I have to check the hints to understand since they dont first teach, then challenge.
I found it out
you defined the let repeatNum = “42 42 42”; incorrectly, so it isnt showing.
so it needs to be revamped or rewritten
I don’t understand what you mean by
That line of code is perfectly valid.
I’m not arguing with you but that’s just what my computer says and it might just be something else lurking in the code (Even though it’s only three lines)!
I suspect that your codepen environment is set up incorrectly.
I wouldn’t know. what environment do you suggest?
Thats weird I just copied and pasted
PERSONAL INFORMATION REDACTED
If you click on the challenge link in the original post, you can use freeCodeCamp’s environment.
You posed some personal information, which I edited out because these pages are indexed and searchable by Google.
I’m still not sure what your question is. You have a correct solution. Do you not understand the solution? Did you overlook the explanation on how capture groups work?
Is there a part of the explanation we can clarify?
Maybe the examples and reading are concise for a reason but I wouldn’t be able to answer some of the challenges without the hints and videos. Now that I’ve moved on it makes more sense in the reading but I often have to go back over everything several times with supplementation regardless of how many notes I take to actually understand.
I was originally asking if I had grasped that concept. caret begins digits repeat, white space, i dont remember what the 1 is for and then $ signifies what should go at the end? I think im getting it.
It just gets so frustrating.
someone should put an end to passwords!!
We do try to keep the examples somewhat short so they are not overwhelming. Regex are particularly difficult, and its perfectly normal to look at outside resources.
The 1 means that you are referencing the first capture group you created,
I am hoping that passwords will eventually go away, but Regex is much more broadly useful.