Regular expression character meaning :

Match any character

accord with 0~9 Any numeric character

accord with 0~9 Characters other than

accord with /t,/n,/x0B,/f,/r Equal space character

accord with a~z,A~Z,0~9 Equal character , That is, numbers and letters match

accord with a~z,A~Z,0~9 Characters other than equal , That is to say, except for numbers and letters

for instance , If there is a string abcdebcadxbc, If used .bc For comparison , Matching substrings have abc,ebc,xbc
3 individual ; If using, The only substrings that match are abcd.

Character class example

accord with a,b or c

accord with a or b or c Characters other than

accord with a~z Or maybe A~Z Characters of

a~d Or maybe m~p, It can also be written as [a-dm-p]

a~z And it's d or e or f, The result is d or e or f Can match

a~z And it's not b or c

a~z And it's not m~p

Specify beyond one character , You can also add “ Greedy Quantifiers ”(Greedy Quantifiers) To specify the number of possible occurrences of a character .

Examples of greedy quantifiers

X Once or not at all

X Zero or more times

X One or more times

X Can appear n second

X At least n second

X{n, m} 
X At least n second , But not more than m second

in addition , also Reluctant quantifiers,Possessive
quantifiers Designation of etc , Self reference java.util.regex.Pattern class API Description in document .

Java stay J2SE
1.4 Regular expression support later , You can API Documented java.util.regex.Pattern Find supported regular expression related information in class , Regular expressions can be applied to string matching , replace , Separation and other actions

Split instance :

        String IPString = "(.+)( Classification number :.+ )*";// Qualified regular expression
         if (IPS.matches(IPString)) {
            int start = IPS.indexOf(" Classification number :");
            int last = IPS.lastIndexOf(" ");
            s = IPS.substring(start + 4, last);

©2019-2020 Toolsou All rights reserved,
Python Basic knowledge and notes Programmer Tanabata Valentine's Day confession code NOI2019 travels China's longest high speed rail officially opened ! The fastest way to finish the race 30.5 hour C Language programming to find a student's grade Software testing BUG describe ESP8266/ESP32 System : Optimize system startup time Unity Scene loading asynchronously ( Implementation of loading interface ) Baidu , Ali , Tencent's internal position level and salary structure , With job suggestions !PYTHON Summary of final review