-2
我想创建一个正则表达式,这将使我出现,我使用\[start-flashcards\](.*?)\[end-flashcards\]
[start-flashcards]
和[end-flashcards]
之间PHP正则表达式的内容用方括号
但这种不匹配的一切。我肯定错过了什么?
<p>[start-flashcards]</p>
<p>[London|This is the capital city of the United Kingdom]</p>
<p>[Paris|This is the capital city of France]</p>
<p>[Madrid|This is the capital city of Spain]</p>
<p>[Tokyo|This is the capital city of Japan]</p>
<p>[Moscow|This is the capital city of Russia]</p>
<p>[end-flashcards]</p>
不,不要使用'[\ s \ S]'。这是一个解决方法。使用'.'和'/ s'修饰符。 –
当你说变通方法时,它是否有任何副作用? – CinCout
内置'.'以更高效的方式更快地匹配。当然,我们没有注意到,但仍然... –