I am trying to check if the user input contains only 0 or 1 with Regex? But It also accepts different values.
inputChange = (e) => {
console.log(/(^$)|[0,1]*/g.test(e.target.value));
};
The method above returns true for a string '222' but when I use online Regex checker it says that my Regex is correct.