HTML Tag analysis

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bnashenas1984
    Contributor
    • Sep 2007
    • 257

    HTML Tag analysis

    Hi everyone

    I have a HTML code in a variable which contains several different tags like this:

    Code:
    $HTMLCode = "
    
    <font color='blue'>Here comes some title for this page</font>
    
    <b>#1 article</b>
    
    <center>This is the body text</center>
    
    <b>#2 article</b>
    
    <b>#3 article /b>
    
    <font color='red'>Text</font>
    
    <b>#4 article</b>
    ";
    This is just an example but it looks almost like my HTML code.

    What I need to do now is to make an array containing articles. That means each row of the array should contain the text inside <b> and </b> tags.

    Is there any way to do it with regular expression or any other function?
    I'v been trying to do it with several explodes and I'm sure that's going to work but thats not a logical way.

    How does Bytes.com analyse [ CODE ] tags?


    Thanks / Behzad
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    How does Bytes.com analyse [CODE] tags?
    I have no idea, but I suppose the input is read linewise.

    and regarding <b>, this should be no problem with a RegEx.

    Comment

    Working...