# BUG: MatchRegex() "\\b" doesn't work

**URL:** https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032
**Category:** Bugs & Issues
**Tags:** formulas
**Created:** [February 22, 2023, 7:52pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032 "2023-02-22T19:52:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)
#### Post date: [February 22, 2023, 7:52pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/1 "2023-02-22T19:52:04Z")

</div>

**In a Formula field, a regex with `\b` never matches anything.**

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/b/b7f05f5d52d3e0211316eb301b3c213ce0c3abb1.png)

**The above Formula should match these entities, but doesn’t match any:**

![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/1/1787dd4c2198a039b75b19e6522ca4d4008105d8.png)

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [February 22, 2023, 8:25pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/2 "2023-02-22T20:25:57Z")

</div>

It seems you’re right, but I don’t know why 😕  
In the meantime, for your specific case, could you just use  
[\W^]PM[\W$]  
instead?

---

<div class="post-metadata">

### Author: ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)
#### Post date: [February 22, 2023, 8:28pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/3 "2023-02-22T20:28:07Z")

</div>

Maybe a Unicode-related bug somewhere? Or escaping/quoting? SQL?

---

<div class="post-metadata">

### Author: ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)
#### Post date: [February 22, 2023, 10:41pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/4 "2023-02-22T22:41:01Z")

</div>

I think it would need to be something more like  
`(^|\W)PM($|^W)`  
because you can’t put `^ $` in a character class - it’s just a literal there.

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [February 23, 2023, 6:21am UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/5 "2023-02-23T06:21:23Z")

</div>

You’re probably right - regex is not my strong point to be honest!

---

<div class="post-metadata">

### Author: ![Sev](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sev](https://community.fibery.io/u/Sev)
#### Post date: [February 20, 2026, 1:54pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/6 "2026-02-20T13:54:11Z")

</div>

Hi! I just came across this issue, and it still does not work i.e. word boundaries in Fibery Regex formula functions somehow do not get passed correctly to the Regex engine.

---

<div class="post-metadata">

### Author: ![Sev](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sev](https://community.fibery.io/u/Sev)
#### Post date: [February 20, 2026, 5:13pm UTC](https://community.fibery.io/t/bug-matchregex-b-doesnt-work/4032/7 "2026-02-20T17:13:26Z")

</div>

Since this issue still persists, I figured I would share the other workaround using negative lookbehind & lookahead assertions to replace the `\b` functionality:

Example: `ReplaceRegex(Text, "(?<!\w)YOUR_WORD_REGEX(?!\w)", "YOUR_REPLACEMENT")`

How it works:

- **`(?<!X)`**: this ensures the the match (i.e. YOUR\_WORD\_REGEX) is not preceded by X. In our example above the X is \w, which means _letters, numbers and \__ in **ASCII** \*.
- **`(?!X)`**: this ensures the the match is not followed by X.

**\* Unicode versus ASCII**  
I have tested this with Unicode characters, and the \w matches exactly as expected. For example `ReplaceRegex("and😀 and €and 𝐀and andé", "(?<!\w)and(?!\w)", "#")` results in `#😀 # €# 𝐀and andé` as expected.

If you somehow still want to expand the definition of your word boundaries, you can convert the `\w` into a character class and add to it. For example `(?<![\w-·])` would stop considering the dash and middle-dot boundaries, too.
