Use regular expressions to replace text with HTML tags starting with a certain character.
P粉438918323
P粉438918323 2023-07-27 14:06:49
0
1
270
<p>I need to convert text into HTML tags, like this: </p> <pre class="brush:php;toolbar:false;">input: p1: Question 1 output: <h3>Question 1</h3></pre> <p>or</p> <pre class="brush:php;toolbar:false;">input: question 1: ¿ question 1? output: <h3>¿ question 1?</h3></pre> <p>The detail I don't understand is that I have the following regex rule. </p> <pre class="brush:php;toolbar:false;">([a-zA-Z])([1-9])(:) (.*)?</pre> <p>And my result is:</p> <pre class="brush:php;toolbar:false;"><h3> Question 1</h3> question 1: ¿ question 1?</pre> <ul> <li>In the first example, I need to remove the space generated between <h3> and Q. <code></code></li> <li>In the second example, it doesn't work at all for me. </li> </ul> <p>Can you help me see where I'm going wrong in my regex rules? </p><p>Demo:</p><p><strong></strong></p>
P粉438918323
P粉438918323

reply all(1)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!