MyBB Community Forums
Badwords Parsing Issue - Printable Version

+- MyBB Community Forums (
+-- Forum: 1.8 Support (
+--- Forum: General Support (
+--- Thread: Badwords Parsing Issue (/thread-173403.html)

Badwords Parsing Issue - Dexie - 07-21-2015

I am using MyCodes with myBB word filtering (bad words) to create a type of internal 'smart linking'.

Here is what I have:

Regular Expression:  \[mylink\]
Replacement: <a href="mylink.wherever"><i>MYLINK</i></a>
Regular Expression: \[mylink2\]
Replacement: <a href="mylink.wherever2"><i>MYLINK2</i></a>

Bad Word:  mylink
Replacement:  [mylink]
Bad Word:  mylink2
Replacement:  [mylink2]

This works absolutely wonderful:

"Mylink takes a user to a specific information page."
MYLINK takes a user to a specific information page.

"Mylink takes a user to a specific information page.  Whereas mylink2 goes to a different page."
MYLINK takes a user to a specific information page.  Whereas MYLINK2 goes to a different page.

This is the problem:  when "mylink" (or 'mylink2' etc.) is used multiple times in the same entry, brackets are placed around the link that was used more than once:

"Mylink takes a user to a specific informaton page.  Whereas mylink2 goes to a different page.  Users like mylink."
[MYLINKtakes a user to a specific information page.  Whereas MYLINK2 goes to a different page.   Users like [MYLINK].

I just learned that "MyCode" will do this all on its own without needing "BadWords" to replace the text with a link.  

In MyCodes do the following:

Regular Expression:  mylink
Replacement: <a href="mylink">mylink</a>

Works like a charm.  For some reason I thought that MyCode required brackets in order to work.

MyCode Syntax - Dexie - 07-21-2015

I am just learning how to use MyCode and do not quite understand the syntax.

I want to create a hyperlink from a word (and all forms of that word) but do not want to change the original form of the word.

For example:
link, linking, linked, links  should all point to link but not change the form of the word used in the original post.

This is what I have:

Regular Expression:   link(.*?)
Replacement:  <a href="link.wherever"><i>LINK$1</i></a>

But, if the user types in "linking" the output is this:

When I want this:

How do I get MyCodes to link the entire form of the word?
Also, is there any documentation about creating custom MyCodes?

RE: Badwords Parsing Issue - Destroy666 - 07-24-2015

There is documentation if you look for it. For example this comment: has almost everything you need to know about regexes used for MyCodes.