I need a regex which matches pattern name1\name2 with the restriction that name1 must not contain some special characters such as < , >. name1, name2 can have spaces.
I am using this regex and it seems to work fine in java script :
/^[^ &<>;]+\\./
In my C sharp code, I am using the regex below:
var pattern= @"^[^ &<>;]+\\.";
The C sharp results fail for the input : 8 [ } \ ;
where as it passes for javascript.
How can I get similar results ?
@decorator means the C# regex contains the two characters \\ where only \ was intended.@"\\"=/\\/.@"\."matches a dot, while@"\\."matches a\and any char. The JS pattern matches the same:/\\./matches a\followed with any char.