Replace character between strings

Posted by trembon on Stack Overflow See other posts from Stack Overflow or by trembon
Published on 2012-04-13T23:20:44Z Indexed on 2012/04/13 23:29 UTC
Read the original article Hit count: 124

Filed under:
|

Maybe it's just too late for me to do this, but I'm trying to replace a character between 2 string with regex in PHP.

Example string:

other | text [tag]text|more text|and more[/tag] end | text

My goal is to replace | with <br/> between [tag] and [/tag].

Tried with this, seems it wasn't that easy though:

/<td>(\|)<td>/gsi

Searched a bit, but couldn't make out an answer with the stuff I found.

Hope you can help, thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about regex