Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] Regular expression to replace a url 'Word Filter'?
#1
Not Solved
I want to create a word filter that takes a url and disables it.
We occasionally get spam and the urls are all the same sites, indian student sites.
So I was thinking to try to try to discourage them we would use the word filter.

What I need is 'website.domain/(any text here)' to be banned.
As they post 20+ random links to pages on the sites.

This way we can filter out unwanted top level urls and any folder they link.

I don't know advanced regular expression, so I don't know how to have the url and filter out anything after the /


This isn't the best but works sort of.

Using Word Filters, I have it so if any specific url if that's posted in a post anywhere the entire post gets hidden, leaving just the title of the thread.
There is probably better ways to do this.
So enlighten me.

Word:
.*website.domain.*

Replacement:
Post hidden: [Website Name][br]Please edit your post to remove the offending links

Due to character limit I can only have a certain amount of text as the notice.
Reply
#2
Not Solved
I'm rubbish at expressions, but wouldn't it be:

*.*/*

Or something along those lines.
Plugin Count: I lost count.
Public Plugins are available here.
Official GitHub.
Please do not PM me for support unless asked to.
Reply
#3
Not Solved
Not sure if this is what you are thinking of.

If its usually the same site you could do like I do for Tinypic. I don't want tinypic on my site as their images are not secure so I set up this word filter.

Word:

tinypic.com

Replacement:

Link Removed.

Change replacement words to whatever you want.
Reply
#4
Not Solved
In current scenario you can't capture unknown length of characters using * with regular expression set to 'no' as * is now representing single unknown character. Hence, to capture 3 unknown characters you have to use ***, if you don't know the exact length of unknown character - you are helpless.

The system is likely to be improved in future version. Modifications are in place to be reviewed.
[Image: logo.svg.svg]
Reply
#5
Not Solved
Well what I have currently captures the entire post if a link is in.
So in a way it works kinda.
To above if I just modified the code without expression it would just change the link url not the link text.
This way the whole spam post gets hidden if a matching domain link is in it.
Though my message and any bbcode has to be within 100 characters.
I guess in a way this will force users to edit their posts to remove that content if they post something not allowed.
Don't know if this is finding a way around intended functionality of expressions.

I did a test post here
The post content are:
As long as the domain link is in the post, it doesn't matter what the rest of the post is, it will show the message replacing the post.

[url=http://examplespamsite.com]Example Spam link[/url]

And it's outputting

Post hidden: [ExampleSpamSite]
Please edit your post to remove the offending links

The code is as above
br is a extra mycode tag I added

Word:
.*examplespamsite.com.*

Replacement
[b]Post hidden:[/b] [ExampleSpamSite][br]Please edit your post to remove the offending links

Regular Expression
Yes
Reply
#6
Not Solved
(07-22-2018, 11:38 AM)drguild Wrote:
-- SNIP --

Regular Expression
Yes

Why not consider this kind of plugin that I use for this kind of thing?

Actually, it's the work of 2 different plugins, one is custom made and the other is available on MyBB.com. 

The plugin:
[Image: 408e7ffa50031438941b1245525bc7b5.png]

The plugin configuration:
[Image: e4a81fd2ffb1c197cbedd2d35d38bc4e.png]

As you can see, you can put in single words and phrases. Those phrases can include URLs.

In the Action option, there are 2 more not shown, Block post, Ban only. 

Those posts that have been blocked are put into the Trash Bin by this plugin.

[Image: d3abfd68e5c216bf2b3d9f819bd670e0.png]

Then the Staff/Admin can review those posts to verify if those are spam/carding/illegal posts. 

If any posts are legit, then those posts can be easily restored. 
No foul and no harm was done!

All of that activity is done behind the scenes and does not affect the flow of the website.
I'm Serpius and You're Not    ¯\_(ツ)_/¯
[Image: 5M7sb0n.png?1]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)