# Match

## ShouldMatch

```cs
var target = "Homer Simpson";
target.ShouldMatch("Bart .*");
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/StringExamples.ShouldMatch.codeSample.approved.cs#L1-L2) | [anchor](#snippet-StringExamples.ShouldMatch.codeSample.approved.cs)

**Exception**

```
target
    should match
"Bart .*"
    but was
"Homer Simpson"
```

## ShouldNotMatch

```cs
var target = "Homer Simpson";
target.ShouldNotMatch("Homer .*");
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/StringExamples.ShouldNotMatch.codeSample.approved.cs#L1-L2) | [anchor](#snippet-StringExamples.ShouldNotMatch.codeSample.approved.cs)

**Exception**

```
target should not match "Homer .*" but did
```
