Sixth chapter Pattern Matchingby FlamephoenixFirst, IntroductionSecond, match operatorThird, special characters in the pattern1, character +2, characters [] and [^]3, characters * and?4. Escape character5. Match any letter or number6. Anchor Mode7.
First, Introductionpattern refers to the character of a particular sequence that is searched for in a string, which is included by a backslash:/def/, Mode def. Its usage, such as combining function split, splits a string into multiple words in a
First, Introduction
Pattern refers to the character of a particular sequence that is searched for in a string, which is included by a backslash:/def/, Mode def. Its usage, such as combining function split, splits a string into multiple words in a
Use options (option)
type 'T option = | None | Some of 'T
Let's look at an example:
> let people = [ ("Adam", None); ("Eve" , None); ("Cain", Some("Adam","Eve")); ("Abel", Some("Adam"
Chapter 6 pattern matching
By flamephoenix
I. IntroductionIi. Matching Operators3. Special characters in the Mode1. Character +2. characters [] and [^]3. characters * and?4. escape characters5. match any letter or number6. Anchor Mode7. replace
Pattern matching function
The most powerful functions in the string library are:
Copy Code code as follows:
String.find (String lookup)
String.gsub (Global string substitution)
String.gfind (Global string lookup)
String.gmatch (
Linux grep option, linuxgrep Option
Grep-I disable case sensitivity
Grep-v print all does not contain .. (Some entries are blocked)
Grep-l print the file name in the inclusion Mode
Grep-c prints the number of rows containing the pattern,
Grep-w:
I will give you a detailed analysis of the Illustrator software and share with you the tutorial on creating a refined and seamless texture pattern.Tutorial sharing:The pattern of a scene is randomly listed on the entire canvas, which forms a pattern
Avoid null useMost languages have a special keyword or object that represents an object that refers to a "none", in Java, which is null. In Java, null is a keyword, not an object, so it is illegal to call any method on it. But this is a confusing
Matching sequence of regular expressions:
1. Mode unit
2. Duplicate match? * + {}
3. Boundary Limit ^ $ b b
4. Mode Selection |
pattern modifier:The pattern modifier is marked outside the entire pattern.
I: Characters in the pattern will match
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.