Learn Regular Expressions Starting from basic concepts, to writing complete sed and Perl scripts, and then to converting HTML files, this powerful tool of regular expressions is explained clearly and thoroughly. There are a large number of concise and clear examples throughout the book, aiming to make readers easily master regular expressions. The book has all online and desktop tools, and introduces advanced reference materials. It is a rare book for getting started with regular expressions.
Content recommendation
"Learning Regular Expressions" explains this powerful tool clearly and thoroughly, starting from the basic concepts of regular expressions, to writing complete sed and Perl scripts, and then to converting HTML files. There are a large number of concise and clear examples throughout the book, aiming to make readers easily master regular expressions. In addition, the book has all online and desktop tools, and introduces advanced reference materials. It is a rare book for getting started with regular expressions.
"Learning Regular Expressions" is suitable for programmers and Internet practitioners who are interested in regular expressions.
About the Author
Michael Fitzgerald is a well-known programmer, consultant, and technical writer. He has written more than ten technical books for O’Reilly and John Wiley & Sons, and published a large number of articles on the O’Reilly Network. He was a member of the RELAXNG Schema Language Committee for XML.
Both online and desktop tools are available,
An essential tool for learning regular expressions,
You can quickly get started even if you don’t know programming.
Table of contents
Foreword
Chapter 1 What is a regular expression 1
1.1 Starting with Regexpal 2
1.2 Match North American phone numbers 3
1.3 Use character groups to match numbers 4
1.4 Use character group abbreviation 5
1.5 matches any character 5
1.6 Capture grouping and backreferences 6
1.7 Using quantifiers 6
1.8 Bracketing characters 8
1.9 Application Example 9
1.10 What we learned in this chapter 11
1.11 Related resources 11
Chapter 2 Simple Pattern Matching 13
2.1 Match string literals 15
2.2 Match the number 15
2.3 Match non-numeric characters 17
2.4 Matching words and non-word characters 18
2.5 Match whitespace 19
2.6 Let’s talk about matching any characters 21
2.7 Tag text 23
2.7.1 Use sed to label text 24
2.7.2 Tag text with Perl 25
2.8 What we learned in this chapter 26
2.9 Related resources 27
Chapter 3 Boundary 29
3.1 The beginning and end of a line 30
3.2 Word boundaries and non-word boundaries 31
3.3 Other anchor characters 33
3.4 Using metacharacter literals 34
3.5 Add tag 35
3.5.1 Add tags using sed 36
3.5.2 Add tags using Perl 37
3.6 What we learned in this chapter 38
3.7 Related resources 39
Chapter 4 Selection, Grouping and Backreferences 41
4.1 Select operation 41
4.2 Submode 45
4.3 Capture grouping and back references 46
4.4 Non-capturing grouping 49
4.5 What we learned in this chapter 50
4.6 Related resources 51
Chapter 5 Character Group 53
5.1 Negation of character group 55
5.2 Union and difference 56
5.3 POSIX character group 58
5.4 What we learned in this chapter 60
5.5 Related resources 60
Chapter 6 Matching Unicode and other characters 61
6.1 Matching Unicode characters 62
6.2 Matching characters with octal numbers 65
6.3 Matching Unicode character attributes 66
6.4 Matching control characters 68
6.5 What we learned in this chapter 70
6.6 Related resources 70
Chapter 7 Quantifiers 73
7.1 Greed, laziness and possessiveness 74
7.2 Use *, and? Make a match 74
7.3 Match a specific number of times 75
7.4 Lazy quantifier 77
7.5 Possessive quantifier 78
7.6 What we learned in this chapter 79
7.7 Related resources 79
Chapter 8 Looking Around 81
8.1 Looking forward 81
8.2 Anti-lookahead 84
8.3 Looking back 85
8.4 Looking Back 85
8.5 What we learned in this chapter 86
8.6 Related resources 86
Chapter 9 Marking Documents with HTML 87
9.1 Match tag 87
9.2 Use sed to convert ordinary text 89
9.2.1 Replace with sed 89
9.2.2 Use sed to process Roman numerals 90
9.2.3 Use sed to process specific paragraphs 91
9.2.4 Use sed to process multi-line poetry 91
9.3 Append tag 92
9.4 Convert normal text with Perl 94
9.4.1 Processing Roman numerals with Perl 95
9.4.2 Processing specific paragraphs with Perl 96
9.4.3 Processing multi-line poetry with Perl 96
9.4.4 Using Perl command files 97
9.5 What we learned in this chapter 99
9.6 Related resources 99
Chapter 10 Junior class graduated 101
10.1 Want to attend intermediate class 103
10.2 Tools, implementation programs and libraries 103
10.2.1 Perl 103
10.2.2 PCRE 104
10.2.3 Ruby (Oniguruma) 104
10.2.4 Python 105
10.2.5 RE2 105
10.3 Matches North American phone numbers 105
10.4 Matching email addresses 106
10.5 What we learned in this chapter 106
Appendix Regular Expression Reference 107
Glossary 118
Index 122
Author and cover introduction 124
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn