I would like to allow numbers higher than 0 in an input field of a react app - javascript. I don't want to have 0 only if it's the first letter. For example 1, 5, 15, 20, 500, 1000005 would be allowed, but 0.5 not. I found this Regex online, however it blocks ALL 0's from being entered.
const [val, setVal] = useState("");
return (
<div className="App">
<input
value={val}
onChange={(e) => setVal(e.target.value.replace(/[^1-9]/g, ""))}
/>
</div>
);
^in front:/^[^1-9]/.