Increase allowed length of watched words

Hi guys,

I am trying to send posts containing (international) phone numbers to the approval queue, and am trying to add the following regex as a watched word:

^(\+|00)((?:9[679]|8[035789]|6[789]|5[90]|42|3[578]|2[1-689])|9[0-58]|8[1246]|6[0-6]|5[1-8]|4[013-9]|3[0-469]|2[70]|7|1)(?:\W*\d){0,13}\d$

However, it is over the current limit of 50 characters for watched words. I believe this limit made sense before regex was added as an option for watched words, but is there still a good reason for keeping this limit in place?

Or is there a way of overriding it?

2개의 좋아요

I’m also need more than 50 chars for my RegEx for identifying IBAN:

\b[A-Z]{2}[0-9]{2}(?:[ ]?[0-9]{4}){4}(?!(?:[ ]?[0-9]){3})(?:[ ]?[0-9]{1,2})?\b

When do you think you will answer that request?

There is no way of overriding this, I guess we are almost at the rule of 3 here about adding a longer limit.

@david are there any concerns around doubling the size?

2개의 좋아요

All watched words are combined to form a single regex, so we do need to be a little careful. But doubling to 100 is probably fine - no worse than two, 50 character “words”.

Here’s a PR for the change

https://github.com/discourse/discourse/pull/11437

8개의 좋아요

That’s merged - watched words can now be up to 100 chars long.

4개의 좋아요

Thank you very much for that change! Have nice holidays and christmas!

1개의 좋아요

This topic was automatically closed after 9 hours. New replies are no longer allowed.