--- id: 646d42f58deb2fc52adc6611 title: Step 81 challengeType: 0 dashedName: step-81 --- # --description-- Now that you've parsed and evaluated the multiplication and division operators, you need to do the same with the addition and subtraction operators. Declare an `infix` variable, and assign it a regular expression that matches a number (including decimal numbers) followed by a `+` or `-` operator followed by another number. # --hints-- You should declare an `infix` variable. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*(?:const|let|var)\s+infix\s*=/); ``` You should use `const` to declare your `infix` variable. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=/); ``` Your `infix` variable should be a regular expression. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\//); ``` Your `infix` regex should use a capture group. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(/); ``` Your first capture group should use a character class. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[/); ``` Your first capture group should match one or more digits or decimal points. Use the `\d` character class. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` Your `infix` regex should use a second capture group. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); ``` Your second capture group should use a character class. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[/); ``` Your second capture group should match either the `+` or `-` operator. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)/); ``` Your `infix` regex should use a third capture group. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(/); ``` Your third capture group should be the same as your first capture group. ```js assert.match(code, /const\s+applyFunction\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\)\s*;?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/\s*;?/); ``` # --seed-- ## --seed-contents-- ```html