Can You please explain me...

Discussion in 'PHP' started by meanbastard, Oct 6, 2008.

  1. #1
    I`m very sorry for the stupid question,but what is the meaning of ^ in front of and $ at the end of the string?

    ereg('^([0-9]{1,3}\.){3}[0-9]{1,3}$',$var))
     
    meanbastard, Oct 6, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    The start and ending of the regex, nothing more (hope i'm not wrong ;))
     
    EricBruggema, Oct 6, 2008 IP
  3. meanbastard

    meanbastard Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    In php.net they don`t say what those symbols do,I saw them in the examples below...
     
    meanbastard, Oct 6, 2008 IP
  4. Sillysoft

    Sillysoft Active Member

    Messages:
    177
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Sillysoft, Oct 6, 2008 IP
  5. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Something like that :)
    The start and ending of the subject string.
     
    GuitarFix, Oct 7, 2008 IP
  6. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    its a condition in regex so if you have a regex that you are trying to match an url you could use th ^ to check wether it contains a www. and if it does contain a www. carry on matching other parts of the string / url

    dont say i never give you anything :) http://www.phpvideotutorials.com/regex/
     
    cornetofreak, Oct 7, 2008 IP