---
title: Match a text against a regular expression in Centrldesk
description: Match a text against a regular expression in Centrldesk
---

[Centrldesk help center ](https://www.centrldesk.com/help)

# [Match a text against a regular expression in Centrldesk](https://www.centrldesk.com/help/library-text-functions-matches)

 Written by [Sebastian](https://www.centrldesk.com/help/author/sebastian) | Mar 30, 2022 1:51:56 PM

The Text Matches block is used to match a text against a regular expression.

A regular expression or regex is a sequence of characters that specifies a search pattern in text. If the text matches the regex to be checked, it evaluates to true. If not, false is returned.

Example A:

Using the input Expression 'gray|grey' for input texts 'The color is gray' and 'The color is grey' true is returned.

Example B:

Using the input Expression 'b[aeiou]bble' for the input texts 'babble', 'bebble', 'bibble', 'bobble' and 'bubble' true is returned.

Result:

True or false depending on whether the text matches the expression.

Tips and best practices:

List of regular expression examples:

| **Regex** | **Matches any string that** |
| --- | --- |
| hello | contains {hello} |
| `gray\|grey` | contains {gray, grey} |
| `gr(a\|e)y` | contains {gray, grey} |
| `gr[ae]y` | contains {gray, grey} |
| `b[aeiou]bble` | contains {babble, bebble, bibble, bobble, bubble} |
| `[b-chm-pP]at\|ot` | contains {bat, cat, hat, mat, nat, oat, pat, Pat, ot} |
| `colou?r` | contains {color, colour} |
| `rege(x(es)?\|xps?)` | contains {regex, regexes, regexp, regexps} |
| `go*gle` | contains {ggle, gogle, google, gooogle, goooogle, ...} |
| `go+gle` | contains {gogle, google, gooogle, goooogle, ...} |
| `g(oog)+le` | contains {google, googoogle, googoogoogle, googoogoogoogle, ...} |
| `z{3}` | contains {zzz} |
| `z{3,6}` | contains {zzz, zzzz, zzzzz, zzzzzz} |
| `z{3,}` | contains {zzz, zzzz, zzzzz, zzzzzz} |
| `z{3,}` | contains {zzz, zzzz, zzzzz, ...} |
| `\\d` | contains {0,1,2,3,4,5,6,7,8,9} |
| `\\d{5}(-\\d{4})?` | contains a United States zip code |
| `1\\d{10}` | contains an 11-digit string starting with a 1 |
| `[2-9]\|[12]\\d\|3[0-6]` | contains an integer in the range 2..36 inclusive |
| `^cat` | begins with "cat" |
| `cat$` | ends with "cat" |
| `^cat$` | is exactly "cat" |

Library:

Text

[View full post](https://www.centrldesk.com/help/library-text-functions-matches)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Sebastian"
  },
  "dateModified" : "2022-04-29T07:31:58.196Z",
  "datePublished" : "2022-03-30T13:51:56Z",
  "headline" : "Match a text against a regular expression using Text Matches block",
  "image" : {
    "@type" : "ImageObject",
    "height" : 520,
    "url" : "https://7836215.fs1.hubspotusercontent-na1.net/hubfs/7836215/library-text-functions-matches-1.png",
    "width" : 1900
  },
  "mainEntityOfPage" : "https://www.centrldesk.com/help/library-text-functions-matches",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Centrldesk help center"
  }
}
```