Step 84 Javascript Spreadsheet

My code:

const applyFunction = str => {
  const noHigh = highPrecedence(str);
  const infix = /([\d]+(.[\d]+)?)([+|-])([\d]+(.[\d]+)?)/
}

Link to the Step

Console is returning

  1. Your first capture group should match one or more digits or decimal points. Use the \d character class.

Ive tested regex in a regex tester and it seems to be working, catching decimals and whatnot.
Any help would be appreciated

you do not need to use [] to define a character class if you are already using \d

1 Like
const applyFunction = str => {
  const noHigh = highPrecedence(str);
  const infix = /(\d+(.\d+)?)(+|-)(\d+(.\d+)?)/
}

After applying that change, the console reverts back to step 5

  1. Your first capture group should use a character class.

the first capture group starts where you have the first (… maybe you have an extra one?

the regex requested by the step is simpler than what you are doing, you will need three capture groups, the middle one matching the + or - using a character class (not the |), the first and last will be equal, you don’t need to worry about building a number, only to accept digits and period

Thanks for the response. For some reason, \d is not being recognized as a character class, I will keep trying with the advice you provided

I’m stuck on the first capture group

  const infix = /(\d+.\d+)([\+-])/

Still returns

  1. Your first capture group should use a character class.

Removing square brackets prompts for character class

use the character class with [] to put together digts and period, do not build a number, just allow them in any order