We know that the regular expression can use \ uxxxx to represent Unicode encoding, for example, [\ u4e00-\ u9fa5] To represent double-byte characters.
BlogA friend left a message asking me how Regex supports Unicode. So I want to extract the
(4) RegEx, RegEx, and RegEx
Content of this chapter:
Decorator
Re Regular Expression
Decorator
The decorator is a well-known design model and is often used in scenarios with cut-plane requirements. It is more classic in terms of
VarThe following methods are commonly used in the conversion of such data to Chinese issues.1. Eval parsing or new Function ("' + str + ')" ()// "I am a Unicode encoding"2. Unescape parsing// "I am a Unicode encoding" C # Chinese and Unicode
Keywords: javascript Chinese character conversion to Unicode unicode encoding conversion to Chinese Character
Conversion of JavaScript Chinese Character unicode encodingCode.
Javascript Library -Javascript
VaR Gb2312unicodeconverter =
Regular expressions provide a compact notation that can be used to represent a combination of strings, and a single regular expression can represent an infinite number of strings. 5 Common uses: analysis, search, search and Replace, string
can only enter Chinese
/**
* 22. Verify Chinese character
* Expression ^[\u4e00-\u9fa5]{0,}$
* Describe only Chinese characters
* Matching example qingqing Moon * * *
@Test public
void A1 () {
Scanner sc = new Scanner (system.in);
Python has its own regular expression engine (built-in re module), but the supported features are thin, and none of the following features are supported:
Curing Group Atomic Grouping
Occupy priority quantifier possessive quantifiers
Unicode conversion, Chinese character conversion, unicode encoding
Import java. util. regex. matcher; import java. util. regex. pattern; public class Translator {/*** convert Chinese characters to Unicode ** @ param s * @ return */public static
Conversion between UNICODE and Chinese character encoding
To avoid Chinese garbled Characters During data transmission in the browser, We can encode the content in URL or UNICODE. UNICODE encoding of Chinese characters, such as "King", which becomes
What is a regular expression?Regular expressions, also known as formal representations, general representations (English: Regular Expression, often abbreviated as regex, RegExp, or re) in code, are a concept of computer science. A regular expression
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.