Hi,
New to programming.
I inspected the fCC source code for the Roman Numeral Converter and on line 36 there is: str.match(/[e.]/g))
What is the e. in regex? It seems to match any non-numerical value but I can’t find reference to it doing that.
Hi,
New to programming.
I inspected the fCC source code for the Roman Numeral Converter and on line 36 there is: str.match(/[e.]/g))
What is the e. in regex? It seems to match any non-numerical value but I can’t find reference to it doing that.
You should not look at the solution source code before finishing and submitting the project yourself.
In the above regular expression [e.] is look for every occurrence of either e or . in the string.
Example code:
const str = "Hello. How are you?";
const matches = str.match(/[e.]/g);
console.log(matches);
output:
[ 'e', 'e', '.', 'e' ]
Thank you! I just realized that line is there to catch input of “e” as exponent or “.” as decimal point. Now that makes sense.
Note, you really, really should not be looking at the solution at all before submitting your own.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.