Hi all,
I am trying to create a regular expression but i'm not 100% successful in it. I hope some body can help me out.
Here is the situation. I have the string as shown below
Code:
I will be sending one more message
> I am fine. tell about yours
>
> > Hi, What are you doing
> >
> > I hope you are fine
I want to replace the > with <div>tag
so i created this regular expression and used in preg_replace
PHP Code:
preg_replace('/(>){1}/', '<div style="border-left:3px #333333 solid; padding-left:5px;">', $messageContent, -1, $count);
and then using the for loop till $count i closed the <div> tag.
but the output that i get is quite different.
I will be sending one more message. I will replace <div> tag by pipe symbol ( | )
| I am fine. tell about yours
| |
| | | | Hi, What are you doing
| | | | | |
| | | | | | | | I hope you are fine
but i want this output. That is the replacement be only made in that scenario where <br> tag is not joining the '>' symbol. And if there are more than one instances of '>' symbol then only one replacement will be made
| I am fine. tell about yours
|
| | Hi, What are you doing
| |
| | I hope you are fine
Can somebody help me out