Private Sub CalcRegexCheckOK (s As String) As Boolean
Dim lst As List = Array As String( _
$"[^\d()\*\/\+\-\.]"$, _ 'basic allowed characters (negated match with ^)
$"\A[\/\*\)\.]"$, _ 'not allowed at start of string
$"[\+\-\/\*\(\.]\z"$, _ 'not allowed at end of string
$"(\-|\*|\/|\+|\(|\)|\.)\1"$, _ 'duplicate individual characters
$"[\+\-\*\/\.]{2,}"$, _ 'invalid consecutive characters
$"[\+\-\*\/\.\(]\)"$, _ '+ - * / . ( can't go directly befe )
$"[\.\)]\("$, _ '. and ) can't go directly before (
$"\d+\.\d+\.\d+"$) 'nonsense 'double' decimals like 112.23.34
For Each pattern As String In lst
Dim m As Matcher = Regex.Matcher(pattern, s)
If m.Find Then Return False
Next
Return True
End Sub