Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts

    cant find word in string

    I am using preg_match to search html for a particular string

    I have checked and the html is loaded into the variable I need. Currently I am using this syntax to retrieve the word but all I get is 'Array()' with a print_r

    PHP Code:
    $viewResponse htmlspecialchars($response);


    $pattern '/^confirm/';

    preg_match($pattern$viewResponse$matches); 
    ideally I need to get the long alphanumeric string which follows after '&confirm='

    But for now I am trying to get some response from preg_match

    Any ideas?

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    perhaps a diff approach would work

    PHP Code:
    $viewResponse htmlspecialchars($response);
    $respParts explode("&",$viewResponse);
    $j count($respParts);
    for(
    $i 0$i $j$i++){
        if(
    strpos($respParts[$i],"confirm=")){
            echo 
    substr($respParts[$i],8);    
        }



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •