I have the following .NET regular expression, that validates my data on the back-end:
[_#\p{Ll}\p{Lu}0-9]{1}[/()0-9\p{Ll}\p{Lu}_\.\s-\?]*
I have to make the same validation in JavaScript, so i translated it like this:
^[#\\u0400-\\u04FF\w][\/\(\).\\u0400-\\u04FF\s\w]*
It is weird that it works just fine in the online tester, but it does not in the console or in my code:
function ValidateColumnName(strColName){
var regex = /^[#\\u0400-\\u04FF\w][\/\(\).\\u0400-\\u04FF\s\w]*/gu;
return regex.test(strColName);
}
ValidateColumnName("中");
Here is a link to my regex online
The meaning of the regex should be:
It can start with one of this symbols: _,#,letter (unicode allowed), number
It can continue with one or more of this: /,(,),numer, letter (unicode allowed),-,.,spaces
Example strings:
Pass:
тест
12тест
_тест
_te st
тест()
те\ст/
...
Not pass:
()тест
$test
!тест
-тест
...
Am i missing something that is in the online tester (by default), but not in my code?