Thread: Need help regex

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

    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Exclamation Need help regex


    Hi guys!

    I need to check a text pattern that go like this "S1234567G"

    but if i use this \b\d{7}\b , it will only match 7 digit number. How can I check for the S infront and with random letters behind.

    I need to match the S with 7digits and randon letters from A-Z.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    29
    Rep Power
    0
    Try
    Code:
    ^S\d{7}[A-Z]$
    S matches literal "S"; [A-Z] is any letter (from A to Z); ^ and $ are the beginning and the end of the string.

    Comments on this post

    • ishnid agrees

IMN logo majestic logo threadwatch logo seochat tools logo