I have the following code in PHP:
if (preg_match('@^[a-z0-9/._-]+$@i', $script)
&& !preg_match('@([.][.])|([.]/)|(//)@', $script))
I'm making the assumption that the predicate for the if
statement returns true for the string js/core.js
.
How would I translate this to C#? The dumb translation is as follows:
if(Regex.IsMatch(script,"@^[a-z0-9/._-]+$@i")
&& !Regex.IsMatch(script,"@([.][.])|([.]/)|(//)@"))
but I suspect that the @
symbol has meaning associated with it that I can't get to the bottom of. A translation to .NET regex would be nice, but I'm entirely familiar with .NET regex, so an explanation of the relevant syntax differences would suffice.
Many thanks.