Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Some common regular expressions     - Tor Browser: under Linux for anonymous Web browsing ultimate browser (Linux)

- Build their own recursive DNS server (Server)

- Observation network performance tools for Linux (Linux)

- C # socket udp broadcast (Programming)

- Docker Basic and Advanced (Linux)

- Crawl use Wireshark packet on remote Linux (Linux)

- Oracle11g CRS-0184 Problem Solving (Database)

- Process safety monitoring and protection under the Linux operating system (Linux)

- The Linux firewall is configured to use proxy (Linux)

- Vi syntax highlighting settings (Linux)

- RHEL7 system making use of OpenStack mirror (Linux)

- Delete specific files using bash directory under Linux (Linux)

- CentOS 6 adds disk quota limit (Linux)

- What is the Docker (Linux)

- AFNetworking + Nginx HTTPS communication server + (Server)

- Some practical tips Linux (Linux)

- W and uptime command (Linux)

- Monitoring Linux System 7 command-line tool (Linux)

- HTTP Client Hints Introduction (Server)

- wget command Walkthrough (Linux)

 
         
  Some common regular expressions
     
  Add Date : 2016-05-02      
         
       
         
  Regular expressions for string manipulation, form validation, and so on, practical and efficient. But use is not always grasp that tend to check something. Now some commonly used expressions gather here to prepare for contingencies.

1. Chinese characters matching the regular expression: [\ u4e00- \ u9fa5]
2. Commentary: Match Chinese really is a headache, with this expression will be easier
3. Match double-byte characters (including Chinese characters included): [^ \ x00- \ xff]
4. Commentary: it can be used to calculate the length of the string (the length of a double-byte character count 2, ASCII character count 1)
5. Match the blank line regular expression: \ n \ s * \ r
6. Commentary: it can be used to remove blank lines
7. HTML tags matching regular expression: <(\ S *?) [^>] *> * | <* />.?.?
8. Comment: The spread of the Internet version is too bad, this is only the top part can match, for complex nested tags remain powerless
9. The first and last match whitespace regular expression: ^ \ s * | \ s * $
10. Commentary: whitespace characters delete the line end of the line can be used (including spaces, tabs, page breaks, etc.), useful expressions
11. Match Email address regular expression:. \ W + ([-. +] \ W +) * @ \ w + ([-.] \ W +) * \ \ w + ([-.] \ W +) *
12.
13. Commentary: When Forms authentication is very useful
14. URL URL matching regular expression: [a-zA-z] +: // [^ \ s] *
15. Comment: The spread of the Internet version of the very limited functionality to meet the basic needs of the above
16. Match account is valid (letter at the beginning, allow 5-16 bytes to allow alphanumeric characters and underscores): ^ [a-zA-Z] [a-zA-Z0-9 _] {4,15} $
17. Commentary: When Forms authentication is very useful
18. Match Domestic telephone number: \ d {3} - \ d {8} | \ d {4} - \ d {7}
19. Commentary: Match the form as 0511-4405222 or 021-87888822
20. Match Tencent QQ number: [1-9] [0-9] {4}
21. Commentary: Tencent QQ number 10000 from the beginning
22. Match China Postal Code: [1-9] \ d {5} (?! \ D)
23. Commentary: China 6-digit postal code
24. Match ID: \ d {15} | \ d {18}
25. Commentary: China's ID card is 15 or 18
26. Match ip address:... \ D + \ \ d + \ \ d + \ \ d +
27. Commentary: extraction of useful ip address
28. match specific figures:
29. ^ [1-9] \ d * $ // matches the positive integers
30 ^ -. [1-9] \ d * $ // matches the negative integer
31 ^ -.? [1-9] \ d * $ // matches integer
32 ^ [1-9] \ d * |. 0 $ // matches the non-negative integer (positive integer + 0)
33 ^ - [1-9] \ d * |. 0 $ // matches the non-positive integers (negative integer + 0)
. 34 ^ [1-9] \ d * \ \ d * |.. 0 \ \ d * [1-9] \ d * $ // matching positive float
. 35 ^ - (.. [1-9] \ d * \ \ d * | 0 \ \ d * [1-9] \ d *) $ // matches the negative float
.? 36 ^ - (..?. [1-9] \ d * \ \ d * | 0 \ \ d * [1-9] \ d * | 0 \ 0+ | 0) $ // match float
. 37 ^ [1-9] \ d * \ \ d * |.. 0 \ \ d * [1-9] \ d * | 0 \ 0+ |?. 0 $ // matches the non-negative floating point numbers (positive float + 0)
38 ^ (- ([1-9] \ d * \ \ d * |.. 0 \ \ d * [1-9] \ d *)) |.?. 0 \ 0+ | 0 $ // non-matching positive float (negative float + 0)
39. Commentary: When handling large amounts of data useful to pay attention to correcting specific application
40. match specific strings:
41. ^ [A-Za-z] + $ // matches a string of 26 letters of the English
42. ^ [A-Z] + $ // matches a string of 26 letters of the English capital composition
43. ^ [A-z] + $ // matches the 26 lowercase letters of the alphabet consisting of a string
44. ^ [A-Za-z0-9] + $ // matches the string of numbers and 26 letters of the English
45. ^ \ W + $ // matches a string of numbers, 26 English letters or the underscore

Commentary: some of the most basic and most commonly used expressions.
     
         
       
         
  More:      
 
- See Linux kernel, CPU, memory, and various versions of the command module and means (Linux)
- MongoDB simple replication configuration (Database)
- How to prevent page five invisible killer (Linux)
- KVM virtualization nested configuration (Server)
- Compile Android libwebcore.so error occurs when solving (Programming)
- Disable unnecessary services under Linux (Linux)
- Under CentOS yum install Nginx smooth switch mounted to Tengine (Server)
- Tip: Use Cryptsetup U disk encryption (Linux)
- Realization of Linux operating system illegal IP censorship (Linux)
- Use Swift remove the spaces in the string (Programming)
- The difference between free command displays the buffers and cache (Linux)
- Bash difference in single quotes and double quotes (Programming)
- How to configure HTTP Strict Transport Security (HSTS) (Linux)
- XP virtual machine under VirtualBox solve occupy 100% CPU problem (Linux)
- dd command: do hard disk IO performance test (Linux)
- MySQL rollback insert statement causes ibd file grows double (Database)
- Setting Squid successful anti-hotlinking (Linux)
- The most concise Systemd tutorial, just ten minutes (Linux)
- CentOS installation of the ftp (Linux)
- MySQL primary and secondary replicate data inconsistencies (Database)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.