


Segment Chinese and English sentences without garbled characters_PHP tutorial
Thinking:
1. Encode the string with urlencode.
2. Use regular expressions to search for sentences ending with transcoded punctuation.
3.urldecode decoded data
[Code] [PHP]Code
1
echo
urlencode(
',-.-?-!-;-,-。-?-!-;-......'
).PHP_EOL;
2
$str
=
"测试测试,
Test test.
Test test?
Test test!
Test test;
Test test,
Test test。
Test test?测试测试!测试测试;测试测试......"
;
3
echo
$str
;
4
$str
= urlencode(
$str
);
5
preg_match_all (
'/(.*?)(.{3,6}|%2C|.|%3F|%21|%3B|%EF%BC%8C|%E3%80%82|%EF%BC%9F|%EF%BC%81|%EF%BC%9B)/'
,
$str
,
$matchs
);
6
foreach
(
$matchs
[0]
as
$v
){
7
$newArr
[] = urldecode(
$v
);
8
}
9
var_dump(
$newArr
);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The mobile Taobao app software provides a lot of good products. You can buy them anytime and anywhere, and everything is genuine. The price tag of each product is clear. There are no complicated operations at all, making you enjoy more convenient shopping. . You can search and purchase freely as you like. The product sections of different categories are all open. Add your personal delivery address and contact number to facilitate the courier company to contact you, and check the latest logistics trends in real time. Then some new users are using it for the first time. If you don’t know how to search for products, of course you only need to enter keywords in the search bar to find all the product results. You can’t stop shopping freely. Now the editor will provide detailed online methods for mobile Taobao users to search for store names. 1. First open the Taobao app on your mobile phone,

In the era dominated by intelligence, office software has also become popular, and Wps forms are adopted by the majority of office workers due to their flexibility. At work, we are required not only to learn simple form making and text entry, but also to master more operational skills in order to complete the tasks in actual work. Reports with data and using forms are more convenient, clear and accurate. The lesson we bring to you today is: The WPS table cannot find the data you are searching for. Why please check the search option location? 1. First select the Excel table and double-click to open it. Then in this interface, select all cells. 2. Then in this interface, click the "Edit" option in "File" in the top toolbar. 3. Secondly, in this interface, click "

Title: Methods and code examples to solve the problem of garbled characters when importing Chinese data into Oracle. When importing Chinese data into Oracle database, garbled characters often appear. This may be due to incorrect database character set settings or encoding conversion problems during the import process. . In order to solve this problem, we can take some methods to ensure that the imported Chinese data can be displayed correctly. The following are some solutions and specific code examples: 1. Check the database character set settings In the Oracle database, the character set settings are

Win11 is Microsoft's latest operating system, but some users may encounter the problem of displaying garbled characters when booting, which will affect the normal use of the system. This article will introduce some methods to solve this problem. Method 1: 1. Press the [Win+S] key combination, or click the [Search icon] next to the start icon on the taskbar. In the opened Windows search, enter [Control Panel] in the search box, and then click [Open]. The best matching control panel application out of the control panel window; 2. In the control panel window, switch to the [Category] view mode, and then click [Clock and Zone-Region]; 3. In the zone window, switch to the [Management] tab, and then click [Change] System Regional Settings]; 4. [Uncheck] Beta version: Use Unicode

How to deal with the problem of garbled characters in the Linux terminal. When using the Linux system, sometimes the text displayed in the terminal will be garbled. This brings inconvenience to us when using the terminal and needs to be dealt with in time. This article will introduce how to deal with some common Linux terminal garbled problems, and provide specific code examples. Problem 1: Garbled Chinese characters on the terminal. Garbled Chinese characters on the terminal are usually caused by incorrect character encoding settings on the terminal. We can solve this problem by modifying the terminal's character encoding settings. #View the current terminal

Golang regular expressions use the pipe character | to match multiple words or strings, separating each option as a logical OR expression. For example: matches "fox" or "dog": fox|dog matches "quick", "brown" or "lazy": (quick|brown|lazy) matches "Go", "Python" or "Java": Go|Python |Java matches words or 4-digit zip codes: ([a-zA

Want to know what the Excel search shortcut key is? The answer is simple, just use [Ctrl+F] to perform a quick search. We often use Excel to record a lot of different data and names. If we need to change it, it will be inconvenient for us to search because there is too much data, and it will be quite troublesome to search. In fact, we can use a quick search shortcut to find the data we need to change! So, what is the search shortcut key in Excel? Today I’m going to teach you how to use the shortcut search keys in excel tables to save you time and effort in your work. Here I am using this version of Microsoft Office excel 2010 for demonstration. Students who need it can

Title: How to determine whether a string ends with a specific character in Golang. In the Go language, sometimes we need to determine whether a string ends with a specific character. This is very common when processing strings. This article will introduce how to use the Go language to implement this function, and provide code examples for your reference. First, let's take a look at how to determine whether a string ends with a specified character in Golang. The characters in a string in Golang can be obtained through indexing, and the length of the string can be
