Question: I am writing a registration page and I have it so that you have to have at least 8 char, but I want to have a special char included, however the verification doesn`t see that I have typed a special char.

```
const int minLength = 8;
const string pattern = ("[@#$%^&+=!]");
public string Message { get; set; } = $"Password should at least {minLength} characters long and should include a special character {pattern}.";

public bool Check(string value) => !string.IsNullOrEmpty(value) && value.Length >= minLength && value.Contains(pattern);

```

Answer: 
Regex cannot be applied using `Contains` method. `Contains` looks for a sequence of characters inside a `string`.

You would need to do something like this:

```
const int minLength = 8;
const string pattern = ("[@#$%^&+=!]");
Regex regex = new Regex(pattern);
public bool Check(string value) => !string.IsNullOrEmpty(value) && 
                         value.Length >= minLength && regex.Match(value).Success;

```
`String.Contains()` does a literal string match.

to use a Regular Expression, use the `Regex` class

```
    Regex rx = new Regex(@"[@#$%^&+=!]",
      RegexOptions.Compiled | RegexOptions.IgnoreCase);

    // Define a test string.        
    string text = "The the quick brown fox  fox jumps over the lazy dog dog.";

    // Find matches.
    MatchCollection matches = rx.Matches(text);

```