2011-10-05 11:20:17 +02:00
|
|
|
NSFW
|
|
|
|
|
|
|
|
"Not safe for work"
|
|
|
|
|
|
|
|
Scans the message content for the string 'nsfw'
|
|
|
|
(case insensitive) and if found replaces the content
|
|
|
|
with a "click to open/close" link, default is closed.
|
|
|
|
|
2018-01-20 17:01:59 +01:00
|
|
|
If you click on the 'Not safe for work' addon under
|
2017-11-06 09:44:10 +01:00
|
|
|
/settings/addon a text field appears, where you can
|
|
|
|
extend the list of search terms. The terms must be
|
|
|
|
seperated by commas.
|
|
|
|
|
|
|
|
It is also possible to enter profile URLs as values.
|
|
|
|
This is quite useful for the case, that you perhaps
|
|
|
|
don't want to see postings by person_A, but person_B
|
|
|
|
is one of your contacts and person_B used to reshare
|
|
|
|
postings by person_A.
|
|
|
|
|
|
|
|
You can also make use of regular expressions.
|
|
|
|
They also have to be seperated by commas and the
|
|
|
|
regex itself has to be enclosed with slashes:
|
|
|
|
|
|
|
|
... nsfw, /<REGEX>/, politics,...
|
|
|
|
|
|
|
|
---------------
|
|
|
|
A few examples:
|
|
|
|
---------------
|
|
|
|
|
|
|
|
1)
|
|
|
|
Let's say you don't want to see postings which contain
|
|
|
|
the term 'fake news'
|
|
|
|
|
|
|
|
The term could appear in several ways:
|
|
|
|
|
|
|
|
fakenews, fake news, fake_news, fake-news, f@ke news,
|
|
|
|
f4ke news, f4k3 n3ws, and so on and so on and so on.
|
|
|
|
|
|
|
|
You could write every possible version of it as single
|
|
|
|
item into your NSFW-filter list, but this can also be
|
|
|
|
done with a single regex, which matches all of them:
|
|
|
|
|
|
|
|
/f[@4a]k[3e][-_ ]n[3e]w[sz]/
|
|
|
|
|
|
|
|
|
|
|
|
2)
|
|
|
|
Another use case could be, that you are simply not
|
|
|
|
interested in postings about christmas.
|
|
|
|
|
2017-11-08 17:19:51 +01:00
|
|
|
/christmas(?:[-_ ]?(?:tree|time|eve|pudding))?/
|
2017-11-08 16:14:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
ATTENTION:
|
|
|
|
|
|
|
|
It is absolutely important, that you use grouping
|
2017-11-08 17:44:20 +01:00
|
|
|
parentheses instead of capturing parentheses!!
|
2017-11-08 16:14:35 +01:00
|
|
|
|
2017-11-08 17:44:20 +01:00
|
|
|
Grouping parentheses are:
|
2017-11-08 16:14:35 +01:00
|
|
|
|
|
|
|
(?: )
|
|
|
|
|
2017-11-08 17:44:20 +01:00
|
|
|
If you use capturing parentheses, which are
|
2017-11-08 16:14:35 +01:00
|
|
|
|
|
|
|
( )
|
|
|
|
|
|
|
|
it will produce errors and the regex won't work and
|
|
|
|
at least your targets will not get collapsed.
|
|
|
|
|
2017-11-06 09:44:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
3)
|
|
|
|
Another possibility is the usage of a so called
|
|
|
|
'lookbehind' construct. I'll give an example followed
|
|
|
|
by a descripton:
|
|
|
|
|
|
|
|
/(?<!the )\badvent\b/
|
|
|
|
|
|
|
|
The \b is a word boundary, what matches the beginning
|
|
|
|
and the end of a word. The simple pattern of 'advent'
|
|
|
|
would match advent iteself, but also adventure.
|
|
|
|
This can be prevented by
|
|
|
|
|
|
|
|
/\badvent\b/
|
|
|
|
|
2017-11-06 09:58:47 +01:00
|
|
|
The first part of the regex above
|
2017-11-06 09:44:10 +01:00
|
|
|
|
|
|
|
(?<!the )
|
|
|
|
|
|
|
|
is a negative lookbehind. It makes \badvent\b only
|
|
|
|
match, if there is no 'the ' before \badvent\b or in
|
|
|
|
words:
|
|
|
|
|
|
|
|
It looks for 'advent', but doesn't match 'the advent'.
|
|
|
|
|
|
|
|
|
|
|
|
For more informations take a look at the PCRE regex
|
|
|
|
dialect.
|