1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple regular expression question

Discussion in 'PHP' started by slaydragon, Jun 11, 2008.

  1. #1
    Code example.

    #^[a-z0-9-]+\.[a-z0-9-\.]{2,8}$#si
    PHP:
    may i know what does the {2,8} means and what does the si means?

    Help appreciated alot.. thanks in advance:)
     
    slaydragon, Jun 11, 2008 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    repetition between 2 and 8
     
    commandos, Jun 11, 2008 IP
    slaydragon likes this.
  3. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #3
    {2,8} = occurs >= 2 && occurs <= 8
    i = case insensitive
    s = single line mode (dot matches any character even a new line)
     
    Lordo, Jun 11, 2008 IP
    slaydragon likes this.