Functional Programming Spreadsheet - Step 73

Hey there fellow campers, I’ll get straight to the point:

"In your highPrecedence function, declare a regex variable. Assign it a regular expression that matches a number (including decimal numbers) followed by a * or / operator followed by another number.

Each number, and the operator, should be in separate capture groups."


const highPrecedence = str => {
  const regex =     /(\d+\.?\d*)([*/])(\d+\.?\d*)/

" Your regex should use a capture group."

I’m pretty certain this should work for the intended purpose, and ChatGpt confirms it. I’m assuming that fCC asks for a specific solution here, but I’ve been trying different options for way too long and Haven’t been able to find it and, since the Javascript course is going through an overhaul, the answers are not yet up.

Would anyone over at fCC be able to pinpoint the issue (if any)? Thanks in advance, and Happy New Year to everyone, while we’re at it.


UPDATE: OK so I was able to move on to the following lesson by simply editing the URL
and the solution is:

const regex = /([\d.]+)([*\/])([\d.]+)/;

so no need for anyone to look it up. If I may give my two cents though, I don’t think that’s a good solution, as [\d.]+ would match invalid numbers with more than one decimal point (e.g: Hope someone finds this feedback useful and, as always, thank you to everyone who’s taken the time to read this!


I agree. I was just about to respond to this noting that the “correct” solution the tests are looking for has this loophole.

@rodrigo-hlc Also, I added the [spoiler] tags around your solution just so it doesn’t give it away to other people who happen to stumble upon this thread.

1 Like

Ahh thank you very much. I’ve been using fCC for a year but I’m still pretty much a noob when it comes to the forum ^^’

1 Like

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