Reputation: 6458
input string:
<sometag> valid content .....
....line break some more valid content</sometag>
output string:
valid content.....
......line break some more valid content
Please let me know how to do it, thanks.
Upvotes: 0
Views: 140
Reputation: 219930
$string = '<sometag> valid content .....
....line break some more valid content</sometag>';
$string = preg_replace('/<[^>]+>/', '', $string);
Upvotes: 0
Reputation: 4049
$oldstring = "<sometag> valid content ..... ....line break some more valid content</sometag>";
$newstring = preg_replace('/\b<sometag>\b/', '', $oldstring);
$newstring = preg_replace('/\b</sometag>\b/', '', $newstring);
$newstring = preg_replace('<br/>', '', $newstring);
assuming by line break you mean <br/>
Upvotes: 0
Reputation: 24078
You can use the strip_tags()
PHP function instead of a regular expression. See manual.
<?php
$str = "<sometag> valid content .....
....line break some more valid content</sometag>";
echo strip_tags($str);
//valid content .....
//....line break some more valid content
?>
Upvotes: 4