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

Thread: Start to end

  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    96
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Start to end

    Hey,
    Do you know if there is a way I can do something like this:
    PHP Code:
    [start]Hello worldhello world.[/end
    What I want, is where I can search for the text inside the start bracket, yet not outside the end bracket.
    This would help me a ton in what I'm doing.

    I'm not sure what function to use for it though.
    Does anyone know how I can do this?
    Thanks!

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Code:
    $input = '[start]Hello world, hello world.[/end]';
    
    preg_match_all('#\[start\](.+?)\[/end\]#', $input, $matches);
    
    print($matches[1][0]);
    Last edited by MattF; 02-20-2010 at 10:03 PM.


  •  

    Posting Permissions

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