Help create a mask to check the string in JS. That is, there should be a check of the string variable by the following mask. #article[1-10000] . At the beginning of the line is obligatory: #article , and after checking for the presence of any number, say, from 1 to 10,000.

    1 answer 1

    You need a regular expression:

     ^\#article\[([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|1000)\]$ 

    Use by calling

     regexp.test(string);