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 3 of 3

Thread: regex help

  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post

    regex help

    On a page i have things like this:


    <span id="ctl00_ctl00_content_PlayerAvatar_lblNickName">FIND THIS</span>
    That is in the middle of tons of other stuff (its part of a webpage) and i want to find whatever is where "FINDTHIS" is on the page.

    *ADDEDINFO*
    To explain better, what i want the code to do, is search through the source for that span line, and set a variable such as $nickname = "FIND THIS";
    */ADDEDINFO*

    I know im not explaining this very well, but its the best I can do. If you have any questions dont hesitate to ask.
    Last edited by thesavior; 12-31-2006 at 12:09 AM. Reason: Added more information

  • #2
    New Coder
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    49
    Thanks
    0
    Thanked 3 Times in 3 Posts
    try something like this:

    PHP Code:
    preg_match('/<span id="ctl00_ctl00_content_PlayerAvatar_lblNickName">(.*?)<\/span>/s'$source$nickname);
    $nickname $nickname[1]; 

  • #3
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post
    thanks that did it.


  •  

    Posting Permissions

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