Home  >  Article  >  Backend Development  >  How to remove ubb code in php

How to remove ubb code in php

藏色散人
藏色散人Original
2021-03-31 10:37:581598browse

How to remove ubb code in php: first open the corresponding code file; then use "\[.*?\"] to replace ubb; finally use "\d" to replace the number.

How to remove ubb code in php

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

Specific questions:

php regular filter UBB code

[align=center][attach]93[/attach] [/align] [p=30, 2, left]中文[/p]

How to replace all ubb codes with regular rules, and remove the Chinese characters from the numbers in the ubb code.

Implementation method:

First replace ubb with \[.*?\]

and then Replace the numbers with \d.

[Recommended learning: PHP video tutorial]

The above is the detailed content of How to remove ubb code in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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