Matching regular expressions for Chinese characters: [\U4E00-\U9FA5]
Match Double-byte characters (including Chinese characters): [^\x00-\xff]
Application: Computes the length of the string (a double-byte character length meter 2,ascii character 1)
A regular expression that matches a blank row: \n[\s]*\r
Regular expression matching HTML tags:/< (. *) >.*<\/>< (. *) \/>/
Matching a regular expression with a trailing space: (^\s*) (\s*$)
Application: JavaScript does not have a trim function like VBScript, we can use this expression to implement, as follows:
To decompose and transform an IP address using a regular expression:
The following is a JavaScript program that uses a regular expression to match an IP address and converts an IP address to a corresponding numeric value:
However, if the above program does not use a regular expression, and the split function directly to decompose may be simpler, the program is as follows:
1 2 Next page > full text reading tips: Try "←→" button, turn the page more convenient Oh!