A regular expression that matches a Chinese character: [U4e00-u9fa5] matches double-byte characters (including Chinese characters): [^x00-xff] Apply: Computes the length of a string (a double-byte character length meter, 2,ascii character count 1)
A regular expression that matches a blank row: [s|] * Regular expressions that match HTML tags:/< (. *) >.*|< (. *)/>/regular expressions that match the trailing spaces: (^s*) | (s*$) Application: JavaScript does not have a trim function like VBScript, we can use this expression to implement, as follows:
Using regular expressions to decompose and transform IP addresses: 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:
Regular expression matching an email address: w+ ([-+.] w+) *@w+ ([-.] w+) *.w+ ([-.] w+) * Matching the URL of the regular expression: http://([w-]+.) +[w-]+ (/[w-/?%&=]*)? An algorithmic program that uses regular expressions to remove repetitive characters from a string:
JavaScript program that extracts the filename from the URL address using a regular expression, the following result is Page1
Use regular expressions to restrict text box entry in a Web page form: Restrict the use of regular expressions to only Chinese:
Only full-width characters can be entered with regular expression restrictions:
Only numbers can be entered with regular expression restrictions:
You can only enter numbers and English with regular expression restrictions: