# containsPattern

Source: https://taxilang.org/docs/language/stdlib/containsPattern

**Full name:** `taxi.stdlib.containsPattern`

## Signature

```taxi
declare extension function containsPattern(source: String, regex: String): Boolean
```

## Description

Returns `true` if any part of the source string matches the provided regular expression.

Uses partial matching — the regex does not need to match the entire string. Use `^` and `$` anchors for full-string matching.

```taxi
// Partial match — returns true if the string contains the pattern anywhere
find {
   startsWithHe: Boolean = "hello".containsPattern("^he")
   containsEll: Boolean = "hello".containsPattern("ell")
}
```

## Examples

Demonstrates partial matching: anchor patterns, substring patterns, and non-matching patterns.

Query:

```taxi
find {
   matchesStart: Boolean = "hello".containsPattern("^he")
   matchesMiddle: Boolean = "hello".containsPattern("ell")
   noMatch: Boolean = "hello".containsPattern("xyz")
}
```

Result:

```json
{
  "matchesStart": true,
  "matchesMiddle": true,
  "noMatch": false
}
```
