Results 1 to 6 of 6

Thread: IP Address Validation

  1. #1
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default IP Address Validation

    hi ,
    I am facing problem with IP Address validation.

    I wrote the condition like this , this is not working properly what i need.

    Code:

    QRegExp cpu1add2regExp( "((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]).){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])" );
    lecpu1add2->setValidator(new QRegExpValidator(cpu1add2regExp, this));



    1) 000.000.000.000 --to -- 999.999.999.999 // should allow only integers from( 0.1.2.3.4....9) and dot(.)

    2) 112.543.432.33

    x=122 // After x(3 digits one dot(.) should come) and don't allow fourth digit.
    y=543
    z=432
    v=33 // v should be

    Please anybody help me how to write the logic to get the required IP Address. i searched in forum also but didn't find.


    Thanks & Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: IP Address Validation

    Quote Originally Posted by rk0747 View Post
    112.543.432.33
    I guess you do understand that this is not a valid IP address?

    to get the required IP Address.
    What is a required IP address?

    Do you want to check if an IP address is valid?

  3. #3
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: IP Address Validation

    Quote Originally Posted by tbscope View Post
    I guess you do understand that this is not a valid IP address?


    What is a required IP address?

    Do you want to check if an IP address is valid?

    sir ,
    i mean validation for lineEdit control when i want to enter the IP Address into lineEdit controll, that control should be allow only IP address . don't allow any alphabets ,characters except dot(.)

    IP Address contain four parts and must three dots(.):
    first part should contain 3 digits.(must)
    second part should contain min 1 digit and max 3 digits..
    third part should contain min 1 digit and max 3 digits.
    four part should contain minimun 1 digit.


    ex: 122.234.443.441
    421.412.112.44
    255.255.336.632
    133.331.123.2
    255.0.0.0
    121.0.0.23




    Below ADDRESS should not accept: should give error

    ex: 24.253.321.422
    23535.35.353.33
    3532.333.332
    Last edited by rk0747; 10th June 2010 at 07:26. Reason: updated contents

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: IP Address Validation

    What is this for? Is it for a network you are creating? As it's certain not valid for IPv4, which typically is what people mean by 'IP Address'.

  5. #5
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: IP Address Validation

    yes, use for ethernet . my lineEdit control should accept only IP Addresses(format).

    sorry, i have to say lineEdit validation not IP validation.
    Last edited by rk0747; 10th June 2010 at 08:08. Reason: updated contents

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: IP Address Validation

    The standard for ethernet is IPv4

Similar Threads

  1. Ip Address Validation
    By bruccutler in forum Qt Programming
    Replies: 26
    Last Post: 3rd November 2010, 03:58
  2. XML Validation
    By NoRulez in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2010, 13:07
  3. Validation
    By Tavit in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2009, 07:03
  4. validation on an IP address
    By rajveer in forum Qt Programming
    Replies: 15
    Last Post: 24th August 2008, 00:35
  5. XML DTC validation problem
    By shailesh in forum Qt Programming
    Replies: 1
    Last Post: 16th March 2006, 13:12

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.