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.