SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast mgsninja's Avatar
    Join Date
    Dec 2001
    Location
    Norway
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [a]text[/a] :: how do I get the text?

    I want to use [] [/] "boxes" to store some information. but I have no idea of how I can extract that info.

    Anyone who knows how to do this?
    ...

  2. #2
    The short answer is yes... Herbster's Avatar
    Join Date
    Oct 2001
    Location
    Bay City, Oregon
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mgsninja
    I want to use [] [/] "boxes" to store some information. but I have no idea of how I can extract that info.

    Anyone who knows how to do this?
    Regex gurus will probably have a cleaner solution, but I like code I can read, lol.
    PHP Code:
    $MyString $whatever;
    $start strpos($MyString,"[" );
    $start strpos($MyString,"]",$start)+1;
    $end strpos($MyString,"[",$start);
    $parsed substr($MyString,$start,($end $start)); 

  3. #3
    SitePoint Enthusiast mgsninja's Avatar
    Join Date
    Dec 2001
    Location
    Norway
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I'll start to examine your code
    ...

  4. #4
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    preg_match('/\[a\](.*?)\[\/a\]/si''[a]hello[/a]'$result); 
    and then you have $result[1] with your text value.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  5. #5
    SitePoint Enthusiast mgsninja's Avatar
    Join Date
    Dec 2001
    Location
    Norway
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I'll start to examine your code too

    A + too both of you.
    ...


Bookmarks

Posting Permissions

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