# كلمات المراقبة regex: حدود الكلمة لا تعمل كما هو متوقع

**URL:** https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813
**Category:** Bug
**Created:** [23 يناير 2018، 9:57م UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813 "2018-01-23T21:57:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [23 يناير 2018، 9:57م UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/1 "2018-01-23T21:57:47Z")

</div>

I’ve set up a rule `\bass\b` and I’m getting inconsistent results:

 ![25%20PM](https://global.discourse-cdn.com/meta/original/3X/a/c/ac07449193fdfc137eab02d050bdaf35e3e2ed7e.png)

Shouldn’t just the word “ass” be censored here?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [24 يناير 2018، 1:14ص UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/2 "2018-01-24T01:14:19Z")

</div>

Are we 100% sure the `watched words regular expression` site setting was flipped to true?

If that is at its default (false) then watched words wouldn’t be regular expressions at all, but also it wouldn’t be matching as it is in your screenshot … so I’m not sure. @neil?

I also can’t repro this on my instance of discourse @awesomerobot :

- turn on `watched words regular expression`
- enter `\bass\b` in censored section
- I see correct [word boundary only](https://www.regular-expressions.info/wordboundaries.html) censoring

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [24 يناير 2018، 1:32ص UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/3 "2018-01-24T01:32:47Z")

</div>

Just repro’d it on Try. For some reason the word boundary isn’t working when ass and assassin are on the same line. The boundary seems to work fine if I put assassin on a new line.

[https://try.discourse.org/t/this-is-a-test-post-with-censored-words/969](https://try.discourse.org/t/this-is-a-test-post-with-censored-words/969)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [24 يناير 2018، 2:51ص UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/4 "2018-01-24T02:51:21Z")

</div>

Ok there is your repro @neil and @eviltrout I would classify this as a bug for the customer you are working on, too.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [24 يناير 2018، 5:35م UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/6 "2018-01-24T17:35:51Z")

</div>

This case should be fixed now:

[https://github.com/discourse/discourse/commit/dc9723904045a5cf1a3d5f55e34fb582abe73214](https://github.com/discourse/discourse/commit/dc9723904045a5cf1a3d5f55e34fb582abe73214)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [25 يناير 2018، 12:36ص UTC](https://meta.discourse.org/t/watched-words-regex-word-boundary-not-working-as-expected/78813/7 "2018-01-25T00:36:29Z")

</div>


