0

I have the folowing script:

[h1]tekst in header[/h1]
[page]
    [p]text here[p]
    [table]
        [p]http://sitename.nl/file.php?get=[nickname][/p]
    [/table]
[/page]

now i want to get this result:

Array
        (
            [0] => [h1]
            [1] => tekst in header
            [2] => [/h1]
            [3] => [page]
            [4] => Array (.....)
            [5] => [/page]
        )

I cant figure out how to do this. I've tried several preg_match_all options, but i am not experienced with regular expressions.

I apprieciate your help.

  • what is the connection between your first and second scripts? – samayo Jul 10 '13 at 17:32
  • 1
    Oddly enough, the example you give looks like valid XML markup with the exception of [nickname]. Could you just replace [ with < and ] with > and use SimpleXML? Or do you REALLY need to parse it into an array like you're seeking? – Timothy Jul 10 '13 at 17:32
  • 1
    you're basically using a custom html-type language, and regexes are **NOT** suitable for that: http://stackoverflow.com/a/1732454/118068 – Marc B Jul 10 '13 at 17:32

0 Answers0