+ Post New Thread
Results 1 to 5 of 5
Coding Thread, RegEx in Coding and Web Development; I'm doing a recoding of SourceBans which is a Steam ID banning system for Multiplayer Online Games (released under Creative ...
  1. #1

    Join Date
    Dec 2008
    Posts
    197
    Thank Post
    7
    Thanked 32 Times in 18 Posts
    Rep Power
    18

    RegEx

    I'm doing a recoding of SourceBans which is a Steam ID banning system for Multiplayer Online Games (released under Creative Commons).

    I'm a bit useless with RegEx - theres a validation line which validates Steam IDs

    define('STEAM_FORMAT', "^STEAM_[0-9]:[0-9]:[0-9]+$");
    Steam IDs are STEAM_x:x:xxxxxxxxx

    I want to change it so it validates Punkbuster GUIDs instead. These are 32 characters log and alphanumeric.

    i.e.

    299f51c289005b05069057e94938afec
    3dbacc0e7126a796c60834b832526c49

    Any suggestions?

  2. #2

    Join Date
    Dec 2008
    Posts
    197
    Thank Post
    7
    Thanked 32 Times in 18 Posts
    Rep Power
    18
    This may have been one Google Search too soon!

    ^[a-zA-Z0-9]+$ seems to do the trick - going to test it properly and will post if any problems.


  3. #3

    Join Date
    Oct 2007
    Location
    Lincolnshire
    Posts
    133
    Thank Post
    0
    Thanked 22 Times in 22 Posts
    Rep Power
    17
    If you want to match exactly 32 characters you can do it like this (assuming your regex library supports this syntax):

    ^[a-zA-Z0-9]{32}$

  4. Thanks to keithu from:

    NeoPlosive (24th July 2009)

  5. #4

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    They're hexadecimal - you don't need g-z

  6. Thanks to PiqueABoo from:

    NeoPlosive (24th July 2009)

  7. #5

    Join Date
    Dec 2008
    Posts
    197
    Thank Post
    7
    Thanked 32 Times in 18 Posts
    Rep Power
    18
    Both very good points!

    Shall give the {32} a try.

    I would have tweaked, eventually, getting a bit tired of coding now been doing it all day.

SHARE:
+ Post New Thread

Similar Threads

  1. Proxy bypass sites regex
    By webman in forum Wireless Networks
    Replies: 7
    Last Post: 15th July 2008, 08:49 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •