Hi everyone I had previously posted about a
getting inserted at the beginning of my text and we got that fixed. (here is my previous post with the code)
This should do it, matches
,
or
at the start or end:
preg_replace('#^
|
$#i', "\n", $str);
The tag is matched by:
* Literal
* Optional spaces followed by a forward slash
The |
in the middle is used to denote an alternative condition (i.e. OR
).
Edit
Instead of
you can also write
that you had before.
Edit 2
Multiple occurrences can be matched by just adding +
behind each pattern:
preg_replace('#^
+|
+$#i', "\n", $str);