Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Some common regular expressions     - Android studio multi-channel ultra-compact version of the package (Programming)

- Elasticsearch 2.20 Beginners: aggregation (Server)

- Ubuntu install Eclipse can not find JAVA_HOME problem (Linux)

- Under CentOS 7 installation and deployment environment Ceph (Server)

- Installation and configuration of Hadoop under Linux (Server)

- Shell for loop (Programming)

- How to disable IPv6 in the CentOS 7 (Linux)

- Use nice, cpulimit and cgroups limit cpu usage (Linux)

- Customize the 404 error page Nginx (Server)

- Python developer of time-saving method (Programming)

- Understanding the Linux load average on other UNIX-Like systems (Linux)

- How to remove the Linux memory Cache, Buffer and swap space (Linux)

- Java Foundation - Getting Start (Programming)

- Understanding Linux firewall Iptables (Linux)

- Asynchronous JavaScript loading (Programming)

- Red Hat Enterprise Linux 6.4 Configuring VNC Remote Desktop login access (Linux)

- Shorewall firewall settings under Ubuntu (Linux)

- The method of Linux into the rescue mode (Linux)

- OpenGL shadow map (Programming)

- Let your PHP 7 faster the Hugepage (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:      
 
- Apache Web Security Linux systems (Linux)
- LaTeX Getting Started Tutorial (Linux)
- Linux host dual LAN transceiver package ARP problem (Linux)
- Linux Oracle delete archived logs (Database)
- Manager Docker browser (Server)
- sudo command scenario analysis (Linux)
- Linux / UNIX: Use the dd command to create a 1GB size binary (Linux)
- How to Install Puppet in the Ubuntu 15.04 (Server)
- Boot automatically remove Linux operating history records (Linux)
- Python Flask environment to build (Linux)
- Linux kernel netpoll framework netconsole (Linux)
- How to download GOG games in Linux command line (Linux)
- Python context managers (Programming)
- SaltStack installation and testing (Server)
- Oracle 11g dataguard main library backup and recovery to the test environment in one database error (Database)
- How linux network security configuration (Linux)
- Oracle database import and export (Database)
- Keepalived + Nginx Installation and Configuration (Server)
- SecureCRT in Python scripting study guide (Programming)
- Oracle 10g after the failure to start the upgrade (Oracle instance terminated. Disconnection forced) (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.