I made simple BBCode script and it works all fine. But then later i use a javascript library to beautify my codes in <pre></pre>.
Now the only problem I am facing that I have <br /> tags after each line of code in <pre></pre> tags.
So the question is how could I remove the <br /> tags which ARE INSIDE the <pre></pre> tags only.
A regex with preg_replace seems to be the thing i need but I could not find/make one to match my need. I not much good with regex. :S
Could u provide us an example of the code u want to test please.
Pattern should looks like : '/.*<pre>.*(<br \/>).*<\/pre>/'
Here is the link of my try : https://regex101.com/r/pV2qX8/2
NOTE : u can reverse the capturing braces - It was just to show u it catched only the <br /> inside <pre></pre>.
NOTE 2 : About sub-question u can find the answer : here
(Sub-Q : multiple <br /> instances with condition)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With