I'm sorry if this has been up before but I can't find anythin on google that gives what I want.
I've a field where you can write expressions: x>1
, x>2||x<1
(x>1) && (x<2)
etc.
What I want is a regex that checks the expression so it only can contain a certain valid characters to defend against code injection. a.1
should not match.
So far I'm using this:
expression.match('[xX<>=|0-9&().]')
But this also returns anything that contains any of these characters. What I want is a expression that only returns if all character match any of thoose in the regex.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…