Regular expresion help needed!

Discussion in 'Plugin Development' started by mine-care, Oct 15, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    mine-care

    Hello bukkit comunity, i am in need of a chat filter regex.
    What i want it to do is filter words where * is pressent for instance, lets say that abcd is a bad word;
    when someone says abcd its alrigth i can filter it but when they say a*cd i cannot. while i was reading in regex in the past (stupid me, i never learned them properly) i came across something like that where it replaces a symbol with a missing character.
    Anyone know how to do this?

    Thanks!
     
  2. Offline

    SoloemAA

    I would set-up a list of strings or table for each different form of a bad word. Using similar a example to what you said:
    ABCD is the badword, but when they say: A*CD, make a table based on both or any form of saying it. Perhaps just look for *, and see if the sentence contains any other letter/word. To prevent "*************A*************B******C*****D****"
     
  3. Offline

    mine-care

    SoloemAA
    umm this way it is a pain in the back side i belive, once after i have a set of those words it will take time to loop through them, also there are tons of combinations like @bcd A3cd a*cd @*cd A^cd ect ect ect....
    Thansk though :)
     
  4. Offline

    Totom3

    mine-care You could compare the strings character by character, but you ignore a character if it's a space, *, %, #, @ etc...
     
  5. Offline

    fireblast709

    mine-care what I did, was split the word in single chars, and replace them with a partial regex that had possible replacements. Then, join those parts with a partial regex that accounted for possible whitespace replacements (like . and _)
     
Thread Status:
Not open for further replies.

Share This Page