Regular expressions matching Chinese characters: [/ u4e00- / u9fa5]
Comment: Matching Chinese is really a headache, there is this expression.
Match double-byte characters (including Chinese characters): [^ / X00- / XFF] Comment: Can be used to calculate the length of the string (a double-byte character lengthometer 2, ASCII characters 1)
Regular expression of matching blank line: / n / s * / r comment: can be used to delete blank lines
Matching the regular expression of HTML tag: <(/ s *?) [^>] *>. *? / 1> | <. *? /> Comment: The version of the Internet is too bad, and this is only available. Matching part, there is still no power for complex nested tags.
Regular expression of matching the first tail blank character: ^ / s * | / s * $ comment: You can use a blank character (including spaces, tabs, change, etc.), very useful expressions formula
Match the regular expression of the Email address: / w ([- .] / W ) * @ / w ([-.] / W ) * /. / W ([-.] / W ) * Comment: Form verification Very practical
Regular expression of matching URL: [A-ZA-Z] : // [^ / s] * Comment: The version of the version of the version is very limited, the above can basically meet the demand
Do not match the account (the start of the letter, allowing 5-16 bytes, allowing alphanumeric underscores): ^ [a-za-z] [A-ZA-Z0-9 _] {4,15} $ comment: Form verification practical
Match domestic phone number: / d {3} - / d {8} | / d {4} - / d {7} Comment: Matching form, such as 0511-4405222 or 021-87888822
Match Tencent QQ number: [1-9] [0-9] {4,} comment: Tencent QQ number starts from 10000
Match China Postal Code: [1-9] / D {5} (?! / D) Comments: China Postal Code is 6 digits
Match ID card: / d {15} | / d {18} Comment: China's ID card is 15 or 18
Match IP address: / d /. / D /. / D /. / D comment: useful when extracting IP addresses
Match specific numbers: ^ [1-9] / d * $ // Match positive integer ^ - [1-9] / d * $ // Match Negative integers ^ -? [1-9] / d * $ // match Integer ^ [1-9] / d * | 0 $ // Match non-negative integer (positive integer 0) ^ - [1-9] / d * | 0 $ // Matching non-positive integer (negative integer 0) ^ [1-9] / d * /. / D * | 0 /./ D * [1-9] / d * $ // Match positive floating point number ^ - ([1-9] / d * /. / D * | 0 /. D * [1-9] / d *) $ // Match the pocket number ^ -? ([1-9] / d * /. / d * | 0 /./ D * [ 1-9] / d * | 0? /. 0 | 0) $ // Match the floating point number ^ [1-9] / d * /. / D * | 0 /./ D * [1-9] / D * | 0? /. 0 | 0 $ // Match the number of non-looted points (positive floating point 0) ^ (- ([1-9] / d * /. / d * | 0 /./ D * [1-9] / d *)) | 0? /. 0 | 0 $ // Match non-positive floating point number (load point 0) Comment: Handling a lot of data is useful, pay attention to correction when applying
Match a specific string: ^ [A-ZA-Z] $ // Match string of 26 English letters ^ [AZ] $ // Match string from 26 English letters. ^ [AZ ] $ // Match string ^ [A-ZA-Z0-9] $ // composed of 26 English letters, matching string ^ / w $ // composed of numbers and 26 English letters Character string composed of numbers, 26 English letters or underscores: The most basic is also the most commonly used expression original address: http://lifesinger.3322.org/myblog/? P = 185