+ Reply to Thread
Results 1 to 2 of 2

Thread: Validate string format

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    1

    Validate string format

    I have string with that format : XXXX-XX-XXX-XXXX-XXXXXXXXXX-X where X is integer or text , but two points are required for valid string :
    1) string must starts and ends with an integer
    2) contains only integers separated by dashes

    I am newbie on Regex , so i would prefer if you could give me the Regex format and illustrate it to me.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    15
    Here is the REGEX format with explaination :
    Code:
    ^\d(\d|(?<!-)-)*\d$|^\d$
     ^        ^       ^    ^
     |        |       |    -- is a single digit, or
     |        |       ------- ends with a digit
     |        ----------------consists on digits or dashes not preceded by dashes
     ---------------------starts with a digit

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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