SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I need help on something, I've been talking in another thread and I currently split articles in a very weird way.

    So Now, I want to split on [### [title] ###] however title will be dynamic.

    Thereofre I must use
    split("[\[### ][a-zA-Z0-9.+/*$?!@][ ###\]]", $text);

    Am I correct? So title can be anything.

    Then How would I extract the title, and put it into it's own array? Do you have to use a reghex or something similar?

    -Peter

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also,

    Is it possible to ignore the first

    [### [TITLE HERE] ###]

    Therefore, ignore the first split, so a typical entry would be:

    Code:
    [### [Page 1 - Intro...] ###]
    
    Welcome to the introduction...this is all...continue to the next page if you dare...
    
    [### [Page 2 - Darey are you?] ###]
    
    I see you made it! Congratulations!
    Without ignore the first [### [title] ###] it'd create 3 pages instead of two, am i correct?


    ......But could I still get the title for the first page?

    Thanks allot,
    Peter

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pete,

    it would create 3 pages but only 3 in the sense of the array and the first one would be empty, so you could just knock of the first element of the array.

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Can anyone confirm this split:

    split("[\[### ](\[.\])[ ###\]]", $text, $reg);

    Code:
    [### [Page 1 - Intro...] ###]
    
    Welcome to the introduction...this is all...continue to the next page if you dare...
    
    [### [Page 2 - Darey are you?] ###]
    
    I see you made it! Congratulations!
    In the above example would $reg[1] be "Page 1 - Intro..."



    Can anyone tell me how to ignore the first one but get the title?


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
  •