I'm writing a method to check if input matches either
>=n, >n, <n, <=n or n..n.
Regex has always been something that's been confusing. I feel this would be a good example to understand it better.
so far I'm just checking if it has those characters
const text = '>2';
const regex = /^[<>=.0-9]|g/i;
console.log(regex.test(text));
how do I create a regex that'll only allow those specific patterns / quantifiers? eg. >5 is valid but 5> is not.
what's the terminology behind these types of things?
/^[<>]=?\d+\.?\d*$/