PHP replacement problem. As long as it is not Chinese, numbers, letters to replace--space,. % replaced by _
For example, this file name??? ??? ?? _trax_full Hd_1080ppc.txt
Replaced by--_--_--_trax_full Hd_1080ppc.txt
I'm using the Str_ireplace function as if it's not possible.
Who helps to write a function to replace non-Chinese, numbers, letters--
And then I'm going to use the following function to return $str should be OK.
return Str_ireplace (Array (', ' & ', ' • ', '% '), ' _ ', $str);
Reply to discussion (solution)
Calculate only half-width of English
Preg_replace (' #[^a-z0-9\x4e00-\x9fcf] #iuU ', '--', $str);
Contains full-width half-width English number
Preg_replace (' #[^a-z0-9\xff10-\xff19\xff21-\xff3a\xff41-\xff5a\x4e00-\x9fcf] #iuU ', '--', $str);
The above-mentioned regular does not contain all Chinese characters, so it may be wrong to kill, but the probability is very low.
\xff10-\xff19 Full Angle 0-9
\XFF21-\XFF3A Full-width A-Z
\XFF41-\XFF5A Full-width A-Z
\X4E00-\X9FCF main Chinese characters (few archaic, allogeneic words not in this range)
Calculate only half-width of English
Preg_replace (' #[^a-z0-9\x4e00-\x9fcf] #iuU ', '--', $str);
Contains full-width half-width English number
Preg_replace (' #[^a-z0-9\xff10-\xff19\xff21-\xff3a\xff41-\xff5a\x4e00-\x9fcf] #iuU ', '--', $str);
The above-mentioned regular does not contain all Chinese characters, so it may be wrong to kill, but the probability is very low.
\xff10-\xff19 Full Angle 0-9
\XFF21-\XFF3A Full-width A-Z
\XFF41-\XFF5A Full-width A-Z
\X4E00-\X9FCF main Chinese characters (few archaic, allogeneic words not in this range)
It doesn't seem like it's going to work, but thank you.
Oh, square brackets plus a + sign, with only the single-character replaced
If it's a mixed-up problem, it's about replacing characters with Chinese characters or English numbers.
Oh, square brackets plus a + sign, with only the single-character replaced
If it's a mixed-up problem, it's about replacing characters with Chinese characters or English numbers.
You can use regular to replace only Korean and special symbols.
Oh, square brackets plus a + sign, with only the single-character replaced
If it's a mixed-up problem, it's about replacing characters with Chinese characters or English numbers.
You can use regular to replace only Korean and special symbols.
It's hard to understand the language you're saying.
Is it possible to use regular to replace only Korean and special symbols?
Is it possible to replace only Korean and special symbols with regular?
Which one does that mean?
The range of Korean is ac00-d7af (main font)
Special symbols are difficult, Unicode contains tens of thousands of symbols, and very scattered, some of which we look at as symbols, but may be the language of a certain nation
For example, many of the symbols of mathematical and physical formulas are ancient Greek
Symbols generally only have a small range of