---
title: "Regex.IsMatch clarification using C#"  
description: "Regex.IsMatch clarification using C#"  
author: "Andrew Deniel"  
published: 2013-10-14  
updated: 2013-10-14  
canonical: https://www.mindstick.com/forum/1682/regex-ismatch-clarification-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Regex.IsMatch clarification using C#

The following [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) does not find a [match](https://www.mindstick.com/forum/159713/regex-match-attribute-in-an-html-code), I was expecting it to:

```
class Program
{
    static void Main(string[] args)
    {
        if (Regex.IsMatch("t1", "\bt1\b"))
        {
            return;  // I was expecting this to be hit but it is not
        }
    }
}
```

Can [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) point out what I have done [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when)?

## Replies

### Reply by Anonymous User

You need to escape \b

```
Use \\ to escape it or just use @ verbatim.if (Regex.IsMatch("t1", @"\bt1\b")){    return;  //This works as expected}
```


---

Original Source: https://www.mindstick.com/forum/1682/regex-ismatch-clarification-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
