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.

i need a regex to only accept

Discussion in 'PHP' started by free-designer, Dec 10, 2010.

  1. #1
    hey guys, i need a regex to get the login word only login word but if the "?" mark comes after it then accept it and accept the rest of the string but if the string something like that
    "loginxx?query=value"
    if the string like that dont accept it but if it looks like that
    "login?query=value" or just "login"

    i hope i cleared what i need .
    thanks guys for any help
     
    free-designer, Dec 10, 2010 IP
  2. namduong8889

    namduong8889 Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hope this what you mean
    
    $string = 'login?query=value';
    
    pregt_match('/^login\?/is', $string); //  returns true
    
    PHP:
     
    namduong8889, Dec 10, 2010 IP
  3. free-designer

    free-designer Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot body, thats exactly what i need, i know that it's pretty simple regex but i don't know how to work with regex. Anyway Thanks a lot :)
     
    free-designer, Dec 10, 2010 IP