php regular expression

Discussion in 'PHP' started by googlehelper, Apr 6, 2009.

  1. #1
    i wnt a php regexp code for following
    Validate a youtube url eg:- http://www.youtube.com/watch?v=<<<<VIDEO_ID>>>>
    Validate a image url ending with jpeg jpg bmp png
    Validate a name fiels containing A-Z 0-9 <space> - and _

    i found this url http://regexlib.com/UserPatterns.asp...6-ee9534263d28 containg regex code but can you give me the php code

    validate image ^(http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(?:\/\S*)?(?:[a-zA-Z0-9_])+\.(?:jpg|jpeg|gif|png))$
    validate youtube (\"http:\/\/www\.youtube\.com\/v\/\w{11}\&rel\=1\")
     
    googlehelper, Apr 6, 2009 IP
  2. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    plzz reply guys
     
    googlehelper, Apr 7, 2009 IP
  3. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    any replies.......................
     
    googlehelper, Apr 9, 2009 IP
  4. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You attempted to learn regular expressions yourself?
     
    matthewrobertbell, Apr 9, 2009 IP
  5. rob_v

    rob_v Peon

    Messages:
    72
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    rob_v, Apr 9, 2009 IP
  6. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    a millon thanks although i was not fully satisfied
    the youtube thing worked fine but not the image one
     
    googlehelper, Apr 11, 2009 IP
  7. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #7
    ghprod, Apr 12, 2009 IP