Reputation: 331
I tested a regex using:
Match match = Regex.Match(txtToMatch.Text,txtRegex.Text,RegexOptions.IgnoreCase);
if (match.Success) {
MessageBox.Show("success");
}
The regex that was used was /d
. However, when I tested it on 9
it returned false. Why is this so?
Upvotes: 0
Views: 84
Reputation: 54887
You need to use \d
, not /d
. To avoid getting your string treated as an escape sequence by C#, you could use a verbatim string: @"\d"
.
Upvotes: 1