PHP is a regular expression of basic grammar application learning.
^ Start
$ end
* Match 0 or more of zero or more
"ab*" matches strings A and 0 or more B-composed strings ("a" "AB" "ABB" "abbbbbb" etc)
+ Match one or more single or more
The "ab+" matches the string A and one or more B strings ("AB" "ABB" "abbbbbb" etc) and the difference is that the following must match a B
?
When the company's production database is established, the user name used in the program is ABB, and all the tables belong to ABB. In this way, the permissions of ABB users are almost unlimited, he can drop any table. Another time a few days ago, the developer mistakenly dropped a table.
According to the original plan, the database was changed last week (because
Some PHP regular expression learning PHP regular expression basic syntax application learning.
^ Start
$ End
* Match zero or more
"AB *" matches strings a and 0 or more B ("a" "AB" abb "" abbbbbb "etc)
+ Match one or more
The difference between "AB +" matching string a and a string ("AB" abb "" abbbbbb "etc) consisting of one or more bits is that * must be followed by B.
? Matc
Re module: (Regular expression)Regular expressions are the matching rules of stringsRegular expressions are supported in most programming languages, and the corresponding module in Python is re-Common expression Rules: (All you need to remember)“ . ” #默认匹配除\n之外的任意一个字符,若指定flag DOTALL,则匹配任意字符,包括换行"^" #匹配字符开头,若指定flags MULTILINE,这种也可以匹配上("^a","\nabc\neee",flags=re.MULTILINE)(即:如果flags指定了 re.MULTILINE, 每一行都会尝试去匹配)"$" # matches the end of the character, if specified by flags MULTILINE, Re.search (' fo
s character and then again and string T comparison.And so on, until each character in the string T is equal to a continuous sequence of characters of the string s, the pattern match succeeds, and the first character of the string T in the string s position is the position of T in S, otherwise the pattern match is unsuccessfulVisible BF algorithm is a kind of brute force algorithm, also known as naïve matching algorithm or brute strength algorithm.
Main string BBC
PHP is a regular expression of basic grammar application learning.^ Start$ end* Match 0 or more of zero or more"ab*" matches strings A and 0 or more B-composed strings ("a" "AB" "ABB" "abbbbbb" etc)+ Match one or more single or moreThe "ab+" matches the string A and one or more B strings ("AB" "ABB" "abbbbbb" etc) and the difference is that the following must match a B? Match 0 or a zero or one"AB" matches
In Python, the regular expression module uses the description:The regular expression rule: 1. Common Regular expression symbols: 1 '.'default match any character except \ n, if flag Dotall is specified, matches any character, including line break2 '^'Match the beginning of the character, if you specify the flags MULTILINE, this can also match on (R"^a","\nabc\neee", flags=Re. MULTILINE)3 '$'Matches the end of a character, or E.search ("foo$","BFOO\NSDFSF", flags=Re. MULTILINE). Group () can also
1. Indexes and slices, with indexes and slices, take the corresponding values out and replace them with new valuesHere's an example of using a slice swap valueThe order of execution of the above methods is: (For Alist[0:2]=alist[1:3])1) Remove the value corresponding to Alist[1:3] first.2) Delete the value of Alist[0:2]3) Replace the Alist[1:3] on the alist[0:2]2. Replace with a list method1) use Append and +Using appendUse +The results are the same, and they're all changed.As you can see from t
("', ' 1 111" 121 122 a AA AAA AaB AB ABA ABB Ali Baidu China Chinese China China Middle China mid-Chinese medium '); Shuffle ($arr); Scrambled Array//collator_sort (collator_create (' zh_cn '), $arr),//usort ($arr, function ($a, $b) {return strnatcmp ($a, $b);}); Usort ($arr, function ($a, $b) {return strcmp ($a, $b);}); Echo Implode (", $arr); exit ();? -->ls sorted by: 1 111 121 122 a AA AAA AaB AB ABA ABB
Common Regular Expression symbols'.'default match any character except \ n, if flag Dotall is specified, matches any character, including line break'^'Match the beginning of the character, if you specify the flags MULTILINE, this can also match on (R"^a","\nabc\neee", flags=Re. MULTILINE)'$'Matches the end of a character, or E.search ("foo$","BFOO\NSDFSF", flags=Re. MULTILINE). Group () can also'*'Matches the character preceding the * number 0 or more times, Re.findall ("ab*","Cabb3abcbbac") res
Common Regular Expression symbols'.'default match any character except \ n, if flag Dotall is specified, matches any character, including line break'^'Match the beginning of the character, if you specify the flags MULTILINE, this can also match on (R"^a","\nabc\neee", flags=Re. MULTILINE)'$'Matches the end of a character, or E.search ("foo$","BFOO\NSDFSF", flags=Re. MULTILINE). Group () can also'*'Matches the character preceding the * number 0 or more times, Re.findall ("ab*","Cabb3abcbbac") res
infrared transmission in the 2.4GHz ISM band, and the total data transmission rate is designed as 2mbit/s. Communication between the two devices can be done in a device to device (ad hoc) manner, or in coordination with the base station (base station, BS) or access point (Access Point,ap). In order to obtain good communication quality in different communication environment, the hardware communication mode of CSMA/CA (Carrier Sense Multi access/collision) is adopted.
In 1999, two additional ver
, blist = Alist is the passing of the reference, and now all two references point to the same object (address). So one of the changes will affect the other
And look at set.
ABB = {1, 2, 3}ACC = Abbprint (ID (ABB), ID (ACC)) Acc.add (4) print (ABB) # {1, 2, 3, 4} print (ID (ABB), ID (ACC)) # Equal
It is consistent with
:
: % S/\/4/gc
2. delete unnecessary spaces.
To delete unnecessary spaces behind each line, run the following command:
: % S/\ s \ + $ //
The command specifies that the range is "%", so this will apply to the entire file ." The matching mode of the substitute command is
\ S \ + $ ". This indicates one or more (\ +) spaces (\ s) before the end of the line ($ ). The "to" part of the replacement command is empty :"//". In this way, the matching spaces are deleted.
3. matching repetition mode
The as
Label: Create DATABASE s2015041--Create a database drop DB XXXXXX--Delete Database use master--using the master database go--link symbol for statement and statement CREATE TABLE ABB (CodeintNotNULL,--column name varchar ( -) notNULL,--column Sexint, Degreedecimal( -,2) notNULL--column) Go insert INTO ABB values (1,'Zhang San',0, About); INSERT into ABB VALUES (2,
!"
Response.Write Mid (strtest,17,5)
%>
Outcome: Today
29. Function minute ()
Function: Returns a value indicating the Minutes
Format: Minute (time)
Parameters: Time is the change in time
Example lt;% =minute (#12:23:34#)%>
Results: 23
30. Function month ()
Function: Returns a value indicating the month
Format: Month (time)
Parameters: Time is the date change
Example Results: 9
31. Function MonthName ()
Function: Returns the string (name) of the month.
Format: MonthName (date [,
Internal Classic: "The sky is nothing, the air is from it, the disease is never ". This should be an authoritative General principle of health care. The heart should be quiet, the fame and fortune should be light, and the health should be less serious.
I have summarized that health care should pay attention to food supplements, medicines supplements, dynamic supplement
characters (such as characters A through Z) and special characters (called metacharacters), and be accurate.
Let's look at a couple of regular expression examples:
Program 3: We always use this program to test regular expressions .
Import java.util.regex.*;
Class regex1{public
static void main (string args[]) {
string str= ' For me money, the important thing ';
S Tring regex= "ab*";
Boolean result=pattern.compile (regEx). Matcher (str). find ();
SYSTEM.OUT.PRINTLN (result);
}
}//t
, length to intercept.
Example:
Strtest= "This are a test, today is monday!"
Response.Write Mid (strtest,17,5)
%>
Result: Today
19. Function minute ()
Function: Returns a value that represents the minute
Format: Minute (time)
Parameters: Time is a variable
Example lt;% =minute (#12:23:34#)%>
Results: 23
20. Function month ()
Function: Returns a value indicating the month
Format: Month (time)
Parameters: Time is a date variable
Example Results: 9
21. Function MonthName ()
Function: Retur
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.