I don't have the idea about regex and how to match it with javascript.
I want to validate the string has:-
Min: 0A1
Max: 10J10
like: /10|[0-9][A-J]10|[1-10]/
But it is not working.
Thanks in Advance.
I don't have the idea about regex and how to match it with javascript.
I want to validate the string has:-
Min: 0A1
Max: 10J10
like: /10|[0-9][A-J]10|[1-10]/
But it is not working.
Thanks in Advance.
 
    
    This pattern [1-10] matches a range from 1-1 or 0.
You could use an alternation that matches [0-9] (or [1-9] for the second case) or 10:
^(?:10|[0-9])[A-J](?:10|[1-9])$
let pattern = /^(?:10|[0-9])[A-J](?:10|[1-9])$/;
strings = [
  "0A1",
  "10J10",
  "6A10",
  "11J10"
].forEach(s => {
  console.log(s + " ==> " + pattern.test(s));
}); 
    
     
    
    Try this :
/([0-9]|10)[A-J]([1-9]|10)/
In your regex :
[1-10] is wrong : is the same that : any caracters between 1 and 1 or 0
