Watch Words will recognize words in quote

Hi, everyone. When I was using watch words to automatically flag a post with certain words, I found that it can flag a post whose quote have the specific words. I tried to use regular expression to avoid the situation. But do you guys have a better idea?
Just like

[quote="好?, post:35, topic:197290, username:思源xi路"]
回购率蹭蹭上去。
[/quote]

When I detect “xi”, it just recognize “思源xi路”. That bothers our team a lot.
This is the regular expression I used:

(?<![a-zA-Z0-9])xi(?![a-zA-Z0-9路])

Can we create a regular expression to avoid flagging posts in quote? Thank you!

What’s more, I hope the regular expression will recognize the quote content, not the name or the username.
:wink:

I tried a lot to solve the problem, but ChatGPT seems not able to help with me. Is there anything to do with the Ruby regular expression?

Do you want people to be able to avoid your flags

I think that the regex is likely line-limited, so you won’t be able to use a regex to tell if a line is inside a quote. I could be wrong.

EDIT: I misunderstood.

You just want to avoid flagging the stuff inside of the [quote ... ] tag, not the tag itself.

That seems like a legit feature request.

2 Likes

I don’t think so:

So essentially, I understand this as what it should/shouldn’t ignore:

[quote="ignore this part, post:xyz, topic:abc, username:ignoreThisToo"]
Don't ignore this
[/quote]
Definitely don't ignore this
3 Likes

Thanks. That’s exactly what I want to express.
I just don’t know how to write a regular expression to control that.

I believe pfaffman is right, and that’s not possible:


I tried myself and couldn’t achieve what you want despite valid regex, so there seems to be a limitation here.

2 Likes