• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Complicated regular expression. Help needed.

I'm trying to extract from the following piece of code:

<p class="clsOne">First line <a href="/page1.htm">of text</a><br>Second line <a href="/page2.htm">of text</a><br>Thrird <a href="/page3.htm">line of text</a><br></p>

What I need is everything between the two <p> tags (this I can do) but also everything seperated by a <br> excluding the <a tags>. So in this example I would have:

First line of text
Second line of text
Third line of text

Thanks and hope you can help.

Lux

0
lux_interior
Asked:
lux_interior
1 Solution
 
Michael701Commented:
have you seen this command?
strip_tags
(PHP 3>= 3.0.8, PHP 4 )

strip_tags -- Strip HTML and PHP tags from a string
Description
string strip_tags ( string str [, string allowable_tags])


This function tries to return a string with all HTML and PHP tags stripped from a given str. It errors on the side of caution in case of incomplete or bogus tags. It uses the same tag stripping state machine as the fgetss() function.

You can use the optional second parameter to specify tags which should not be stripped.

Note: allowable_tags was added in PHP 3.0.13 and PHP 4.0b3.


Example 1. strip_tags() example

$string = strip_tags($string, '<a><b><i><u>');
 
 

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now