I'm trying to write a regex for matching a string that starts with a 9, has any number of 9s after the first, followed by zero or more 0s.
So 9 would pass, 99 would pass, 990 would pass, 99990000000 would pass.
But if it includes any character that is not a 9 or a 0, or it includes a 0 between any 9s, it would fail.
991 would fail, 909 would fail, 9900009 would fail.
This is what I've tried:
let regex = /^99*0*/;
But this seems to be letting non- 9or0 characters through, like 91
.
The logic I thought I was writing was "starts with a 9, followed by any number of 9s, followed by any number of 0s". That isn't working apparently.