SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Regular Expression

    hey all

    I have this regular expression

    val.ValidationExpression = "(^[0-9]{1}[0-9]{0,2}(\\,[0-9]{3})*$)"

    this checks for whole numbers.

    My aim is to have whole number like 1000. But this expression only allows me to enter whole numbers with commas like 1,000 or 2,500. But i would like to no how i can twick this expression so it only allows me not to enter 1,000 with a comma so like 1000, 2000 and so on..

    any ideas?

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,649
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Regexes are not my thing, but I usually use something like: (^\d{1,}$) which allows for 1 or more digits.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I have looked Into This

    if your number of occurences are fixed then we can handle it with the help of or (|) operator in the regular expression

    ((^[0-9]{1}[0-9]{0,3}\,)|(^[0-9]{1}[0-9]{0,3}))

    we can repeat it again & agian with or operator


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
  •