Analysis on regular expression replacement of preg_replace in php [Replace multiple values at a time], phppreg_replace
This example describes the usage of preg_replace Regular Expression replacement in php. We will share this with you for your reference. The details are as follows:
1. Both preg_replace and str_replace of php are/g by default, all replace
2. If you want to use a regular expression, use preg_replace.
<? Php $ a = "abc defabcd ef"; $ B = preg_replace ("/\ t | a/", "", $ a); echo ($ B ); /* output: bc defbcd ef */?>
In addition, comparing the replace in js, php syntax is not beautiful.
<! DOCTYPE html>
Run the following command:
PS: here we will provide two very convenient Regular Expression tools for your reference:
JavaScript Regular Expression online testing tool:
Http://tools.jb51.net/regex/javascript
Regular Expression generation tool:
Http://tools.jb51.net/regex/create_reg