SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple javascript syntax question

    Just a quick question about Javascipt (I know it may be silly, but I'm just picking it up and don't understand this line)...

    I got this line of code from some sample javascript and can't understand what the symbols mean.

    PHP Code:
    if (field.value.search(/^\d{10}$/) == -1) {


    Can someone explain to me what this bit means (/^\d{10}$/)? Coz that's what's got me confused.

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is using a what is referred to as a regular expresion to determine if a specific value is in the field. I think this tutorial can give a better explanation than I can.
    http://www.javascriptkit.com/javatutors/re.shtml

  3. #3
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you! That link was very helpful


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
  •