I'm using C#. When I test this pattern at https://regexr.com/ it works but it doesn't work in my application.
I want to disallow whitespace in the input(username and password).
I'm using C#. When I test this pattern at https://regexr.com/ it works but it doesn't work in my application.
I want to disallow whitespace in the input(username and password).
The /
surrounding characters are delimiters for the regex itself -- for example, in javascript you can use those in place of quotes: "Abcd".match(/^\S*$/)
In C#, you must use quotes, so you can write your code simply as:
Regex.IsMatch("Abcd", @"^\S*$")