Home Backend Development PHP Tutorial PHP正则-多个span标签有关问题

PHP正则-多个span标签有关问题

Jun 13, 2016 am 10:03 AM
gt lt quot span style

PHP正则-多个span标签问题

This is fake headline
如何提取标签,让上面的代码变成
[color="color: #ff0000;"][font-size="medium;"]This is fake headline[/font-size][/color]

这两标签相互颠倒的时候,问题就来了,因为他们的结束标签都是一样的,让人抓狂,有什么解决方法么。


------解决方案--------------------
使用preg的贪婪模式
------解决方案--------------------

$str = ' This is fake headline ';

preg_match_all('/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

What are the differences between Huawei GT3 Pro and GT4?

How to modify element.style How to modify element.style Nov 24, 2023 am 11:15 AM

How to modify element.style

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Fix: Snipping tool not working in Windows 11

How to dynamically modify style in react How to dynamically modify style in react Dec 28, 2022 am 10:44 AM

How to dynamically modify style in react

What are the new features in Vue3 style and how to use them What are the new features in Vue3 style and how to use them May 14, 2023 pm 10:52 PM

What are the new features in Vue3 style and how to use them

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

How to Fix Can't Connect to App Store Error on iPhone

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

Vue error: Unable to use v-bind to bind class and style correctly, how to solve it? Vue error: Unable to use v-bind to bind class and style correctly, how to solve it? Aug 26, 2023 pm 10:58 PM

Vue error: Unable to use v-bind to bind class and style correctly, how to solve it?

See all articles