Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Help parsing

Last post 06-30-2009, 10:13 AM by ddrudik. 1 replies.
Sort Posts: Previous Next
  •  06-30-2009, 9:13 AM 54441

    Help parsing

    I have to parse out the content of items separated by square brackets, i.e.,

    [Tag1][Tag2]hello, world[Tag3][Tag4]

    I want to get:

    Tag1

    Tag2

    Tag3

    Tag4

    If I write this:  \[.*\]

    I get the whole string, not the individual parts - any help is appreciated! 

     

     

  •  06-30-2009, 10:13 AM 54445 in reply to 54441

    Re: Help parsing

    Raw Match Pattern:
    \[([^]]*)\]

    $matches Array:
    (
        [0] => Array
            (
                [0] => [Tag1]
                [1] => [Tag2]
                [2] => [Tag3]
                [3] => [Tag4]
            )

        [1] => Array
            (
                [0] => Tag1
                [1] => Tag2
                [2] => Tag3
                [3] => Tag4
            )

    )

View as RSS news feed in XML