#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    How to find and compare numbers?


    I am writing a very complex Genuine Smart IP Filter for Minecraft and all game servers. I'm trying to be as crafty as possible yet allow players to be able to chat without worrying about false positives. Here's a basic example of what I'm trying to do:

    (\d)\s(\d)\s(\d)\s(\d)(?<!\1>\2>\3>\4)

    This is as simple as I think I can make my example... another way of putting it would be:

    (\d)\s(\d)\s(\d)\s(\d)(?<!\1<\2<\3<\4)

    Or

    (\d)\s(\d)\s(\d)\s(\d)(?<!\1=\2=\3=\4)

    I tried doing this very basic regex against the following text but this didn't work:

    1 2 3 4
    5 4 3 2
    1 1 1 1
    4 2 5 8

    I want to catch ONLY 4 2 5 8 and not the rest.
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    The only thing you haven't said is why you're matching what you're matching. Why is 4258 special? Why not 5432?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    my apologies.

    4 2 5 8 is just a random number. I really don't care about the number itself, I just want the pattern. For example, if I said the following:


    Blast off in 5 4 3 2 1!

    I don't want my IP filter to think 5 4 3 2 or 4 3 2 1 is an IP address because it has a pattern. Any number that is said in-game with a pattern needs to be left alone. Any set of 4 numbers that do NOT have a pattern needs to be caught by the IP filter.

    I have a separate filter for legitimate IP addresses such as 192.168.0.1.
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    Putting aside the complexity of what you're talking about,

    There will always be a way around this filter. No periods or spaces? Hyphens. No hyphens either? Slashes. No symbols of any kind? "dot". You won't win.
    Better than this is making sure (I don't know Minecraft) that people can report spammers.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by requinix
    Putting aside the complexity of what you're talking about,

    There will always be a way around this filter. No periods or spaces? Hyphens. No hyphens either? Slashes. No symbols of any kind? "dot". You won't win.
    Better than this is making sure (I don't know Minecraft) that people can report spammers.
    Hey, thanks for the reply! All your concerns have already been successfully coded. I've blocked all foreign characters, coded hyphens, ., dot, (dot), point, (point), and (period). I've already done all the coding. I just need to know how to do the comparisons.
  10. #6
  11. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    You may think you have but I guarantee you there's a way around it.

    You can't do the comparisons with just the regular expression. You need code.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by requinix
    You may think you have but I guarantee you there's a way around it.

    You can't do the comparisons with just the regular expression. You need code.
    Oh... that makes me sad.

IMN logo majestic logo threadwatch logo seochat tools logo