JSFiddle - React, Tailwind, and code Playground

by Oscar Jara

JavaScript

// First 4 numbers must be always 9908
// After the 4 first numbers must be a : as delimiter
// After the delimiter...
// - the allowed values are just numbers from 0-9
// - the min. length is 3
// - the max. length is infinite
// RESULT:
// - Valid: 9908:123 or 9908:123456...
// - Invalid: 9908:12 or 9908:xyz

// value to evaluate
var value = '9908:123';

// regex (shorthand)
var regex = /9908:\d{3,}/g;

// regex (other way)
//var regex = /^9908:\d{3,}$/;

// returns true or false
var evaluation = regex.test(value);

// print
alert('result is: ' + evaluation);