Easy Regular Expression [tag]

Discussion in 'PHP' started by webboy, Jul 6, 2009.

  1. #1
    Hi all just a quick question what the Regular Expression for a preg_match all

    my input data is [tag] tag , tag1 , tag2 [/tag]
    and wish to output the information between them so i get the output of
    tag
    tag1
    tag2

    Thanks..
     
    webboy, Jul 6, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Something like '/(\[tag\])(.+)(\[\/tag\])/' should work for your regex pattern. You would then need to explode or split by ' , '.
     
    jestep, Jul 6, 2009 IP