×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    17

    Unhappy validate text box with regular expression

    Hi,
    Can anyone help me with how to validate text box with regular expression in pys60 with an example?

    Thanks in advance
    Cyan

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: validate text box with regular expression

    Quote Originally Posted by mt.jijo View Post
    Hi,
    Can anyone help me with how to validate text box with regular expression in pys60 with an example?

    Thanks in advance
    Cyan
    hello mj.jijo

    Please don't start multiple threads on the same issue.

    Regards
    Gaba88

  3. #3
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: validate text box with regular expression

    You can try this

    Code:
    import re
    text_box_pattern = re.compile(r'^(\d+).(\d+).(\d+).(\d+)$')
    text_box_pattern.search('192.169.122.231').groups()
    Please try this once and modify for your needs and tell if its working for you.

    -Internship in France over!
    IDEAS is all they need but still they think only Genius can give them that.

  4. #4
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: validate text box with regular expression

    I am using the following regex:

    Code:
    import re
    def check_ip(ip):
        pattern = r"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
        if re.match(pattern, ip) and len(re.findall(r"[^0-9.]",ip)) == 0:
            return True
        else:
            return False

Similar Threads

  1. Replies: 3
    Last Post: 2008-08-01, 07:26
  2. Regular Expressions & Text Processing on S60
    By biodeb in forum General Development Questions
    Replies: 3
    Last Post: 2008-08-01, 07:05
  3. javascript set focus to input text box ??
    By zaponjanx in forum Browsing and Mark-ups
    Replies: 5
    Last Post: 2008-03-12, 09:52
  4. how to move from list box to text editor on dialog box
    By manjunaths in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-12-07, 10:13
  5. Rich Text box cut,copy,paste system error
    By skdas in forum Symbian
    Replies: 0
    Last Post: 2003-05-28, 12:16

Posting Permissions

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