Regular Expression Guide
Edit recommendations
A Guide to the regular expression for answering questions
Technical developers of common text processing and language development must read it!
Basic Information
- Author:Yu Sheng
- Press: Electronic Industry Press
- ISBN:9787121165511
- Mounting time:
- Published on: February 1, May 2012
- Page number: 336
- Pricing: ¥58.00
- Ordinary Member: ¥43.50 (off)
- 1-3 star member: ¥42.34 (off)
- 4-5 star members: $40.60 (off)
- Campus discount price: ¥42.34 (off)
Http://product.china-pub.com/199266&cnblogs
IntroductionBooks
Computer books
The "Regular Expression Guide" summarizes a set of methods for solving the problems encountered by the author during development and other developers' questions, it also guides readers through specific examples to disassemble and analyze problems. The book consists of three parts: The first part mainly describes the basic knowledge of regular expressions, covering various functions and structures in common regular expressions; the second part mainly describes more in-depth knowledge about regular expressions, the coding problem, matching principle, and solving ideas are discussed in detail. The third part introduces the previous knowledge to six common languages. net, Java, JavaScript, PHP, Python, and Ruby not only detail the usage of regular expressions in the language, but also the minor differences between versions, it can be used as specialized learning materials or as a useful reference manual.
The regular guide is suitable for technicians who frequently need Text Processing (such as log analysis or network O & M) and programmers who are familiar with common development languages, and readers who have some knowledge about regular expressions.
DirectoryRegular Expression Guide
Part 1
Chapter 2 character group 2
1.1 normal character group 2
1.2 Basic knowledge about Python 4
1.3 normal character group (continued) 6
1.4 characters and escape 8
1.5 excluded character group 10
1.6 character group notation 12
1.7 character group Operation 14
1.8 POSIX character group 15
Chapter 17 quantifiers
2.1 General Form 17
2.2 Common quantifiers 18
2.3 Data Extraction 21
, 2.4
2.5 point number misuse Question 23
2.6 ignore priority quantifiers 26
2.7 escape 31
Chapter 3 brackets 33.3.1 Group 33
3.2 multiple-choice structure 39
3.3 Reference Group 44
3.3.1 reverse reference 48
3.3.2 record of various references 50
3.3.3 naming group 53
3.4 non-capturing group 54
3.5 supplement 55
3.5.1 escape 55
3.5.2 URL rewrite 56
3.5.3 example 58
Chapter 2 assertions 59
4.1 word boundary 59
Starting/ending position of 4.2 rows: 61
4.3 view 68
4.4 supplement 74
4.4.1 value of ATV 74
4.4.2 view and Group No. 74
4.4.3 support level 75
4.4.4 view combination 77
4.4.5 relationship between assertion and reverse reference 79
Chapter 1 matching mode 81
5.1 case insensitive mode 81
5.1.1 mode: 82
5.2 single row mode 84
5.3 multi-row mode 85
5.4 comment mode 87
5.5 supplement 88
5.5.1 more models 88
5.5.2 modifier range 89
5.5.3 failure modifier 90
5.5.4 mode and reverse reference 90
5.5.5 conflict policy 91
5.5.6 which method is better? 92
Chapter 3 Miscellaneous 93
6.1 escape 93
6.1.1 string and regular escape 93
6.1.2 escape 97 of metacharacters
6.1.3 completely remove special meanings of metacharacters 99
6.1.4 escape 101 in character group
6.2 Regular Expression Processing Form 101
6.2.1 function processing 102
6.2.2 object-oriented processing 102
6.2.3 comparison 103
6.2.4 thread security 104
6.3 Priority 106 in an expression
Part 2
Chapter 2 Unicode 7th
7.1 about encoding 110
7.2 unicode encoding 111 is recommended
7.3 Unicode matching rule 115
7.4 word boundary 117
7.5 code value 119
7.6 Unicode attribute 121
7.6.1 Unicode property 121
7.6.2 Unicode block 122
7.6.3 Unicode script 123
7.7 Unicode attribute list 123
7.7.1 Unicode property 123
7.7.2 Unicode block 125
7.7.3 Unicode script 128
7.8 POSIX character group 129
Chapter 1 matching principles 8th
8.1 finite automaton 130
8.2 matching process of regular expressions 131
8.3 backtracking 134
8.4 NFA and DFA 136
Chapter 1 solutions to common problems 9th
9.1 three logics of elements 138
9.1.1 139 must appear
9.1.2 may be 139
9.1.3 cannot contain 140
9.2 common operations of Regular Expressions 142
9.2.1 extract 142
9.2.2 verification 148
9.2.3 replace 152
9.2.4 splitting 157
9.3 Regular Expression optimization suggestion 159
9.3.1 use cache 159
9.3.2 Express Intent 160 as accurately as possible
9.3.3 avoid repeated matches 160
9.3.4 independent text and anchor 161
9.4 do not rely too much on regular expressions 162
9.4.1 discard the string operation 162
9.4.2 mindset 163
9.4.3 regular expressions can match various types of text 164
Part 3
Chapter 2. Net 10th
10.1 prerequisites 168
10.2 detailed explanation of the Regular Expression Function 169
List of 10.2.1 169
10.2.2 character group 170
10.2.3 Unicode attribute 170
10.2.4 character group notation 171
10.2.5 word limit 171
10.2.6 rows start/end position 172
10.2.7 huanjing 173
10.2.8 matching mode 173
10.2.9 capturing group references 174
10.3 Regular Expression API introduction 175
10.3.regex 175
10.3.2 match 179
10.4 common operation example 180
10.4.1 verification 180
10.4.2 extract 180
10.4.3 replace 181
10.4.4 segmentation 182
Chapter 2 Java 11th
11.1 prerequisites 183
11.2 detailed explanation of the Regular Expression Function 184
11.2.1 list 184
11.2.2 character group 184
11.2.3 Unicode property 186
11.2.4 character group notation 186
11.2.5 word boundary 186
11.2.6 rows start/end position: 187
11.2.7 ATV 188
11.2.8 matching mode 188
11.2.9 plain text mode 189
11.2.10 capture group reference 189
11.3 Regular Expression API introduction 189
11.3.1 pattern 190.
11.3.2 matcher 192
11.3.3 string 194
11.4 common operation example 195
11.4.1 verification 195
11.4.2 196
11.4.3 replace 196
11.4.4 splitting 197
Chapter 2 JavaScript 12th
12.1 prerequisites 198
12.2 detailed explanation of the Regular Expression Function 199
12.2.1 list 199
12.2.2 character group 199
12.2.3 character group notation 200
12.2.4 word boundary 200
12.2.5 row start/end position: 201
12.2.6 huanjing 201
12.2.7 matching mode 202
12.2.8 capture group reference 203
12.3 Regular Expression API introduction 203
12.3.1 Regexp 203.
12.3.2 string 207
12.4 common operation example 210
12.4.1 verification 210
12.4.2 210
12.4.3 replace 211
12.4.4 splitting 211
12.5 about ActionScript 211
12.5.1 regiexp 211
12.5.2 Matching Rule 212
12.5.3 matching mode 212
12.5.4 regularizedapi 212
Chapter 2 PHP 13th
13.1 prerequisites 213
13.2 detailed explanation of the Regular Expression Function 215
13.2.1 list 215
13.2.2 character group 216
13.2.3 Unicode property 217
13.2.4 character group notation 217
13.2.5 word boundary 217
13.2.6 rows start/end position: 218
13.2.7 huanjing 219
13.2.8 matching mode 219
13.2.9 text-only mode 220
13.2.10 capture group references 220
13.3 Regular Expression API introduction 221
13.3.1 description of preg constants 221
13.3.2 preg_quote 222
13.3.3 preg _ grep 223
13.3.4 preg_match 223
13.3.5 preg_match_all 225
13.3.6 preg _ last _ error 227
13.3.7 preg_replace 227
13.3.8 preg _ replace _ callback 227
13.3.9 preg _ filter 228
13.3.10 preg _ Split 229
13.4 examples of common Regular Expressions 230
13.4.1 verification 230
13.4.2 extracts 230
13.4.3 replace 231
13.4.4 segmentation 232
Chapter 2 Python 14th
14.1 prerequisites 233
14.2 detailed explanation of the Regular Expression Function 234
14.2.1 list 234
14.2.2 character group 235
14.2.3 Unicode attribute 236
14.2.4 character group notation 236
14.2.5 word limit 238
14.2.6 rows start/end position 239
14.2.7 huanjing 239
14.2.8 matching mode 240
14.2.9 capture group references 240
14.3 Regular Expression API introduction 241
14.3.1 regexobject 241
14.3.2 re. Compile (RegEx [, flags) 243
14.3.3 re. Search (pattern, string [, flags]) 243
14.3.4 matchobjects 243
14.3.5 re. Match (pattern, string [, flags]) 244
14.3.6 re. findall (pattern, Sting [, flags) 245
14.3.7 re. finditer (pattern, string [, flags]) 245
14.3.8 re. Split (pattern, string [, maxsplits = 0, flags = 0]) 246
14.3.9 re. sub (pattern, REPL, string [, Count, flags) 247
14.4 Common Operation example 248
14.4.1 verification 248
14.4.2 extract 248
14.4.3 replace 249
14.4.4 splitting 250
Chapter 2 Ruby 15th
15.1 prerequisites 251
15.2 detailed explanation of the Regular Expression Function 252
15.2.1 list 252
15.2.2 character group 252
15.2.3 Unicode attributes 253
15.2.4 character group notation 254
15.2.5 word border 254
15.2.6 rows start/end position: 255
15.2.7 huanjing 256
15.2.8 matching mode 256
15.2.9 capturing group references 257
15.3 Regular Expression API introduction 257
15.3.1 regiexp 257
15.3.2 Regexp. Match (text) 259
15.3.3 Regexp. Quote (text) and Regexp. Escape (text) 260
15.3.4 string. Index (Regexp) 261
15.3.5 string. Scan (Regexp) 261
15.3.6 string. Slice (Regexp) 262
15.3.7 string. Split (Regexp) 262
15.3.8 string. sub (Regexp, STR) 263
15.3.9 string. gsub (Regexp, string) 264
15.4 common operation example 264
15.4.1 verification 264
15.4.2 extract 265
15.4.3 replace 265
15.4.4 segmentation 265
15.5 New Changes in Ruby 1.9 266
Chapter 2 Linux/Unix 16th
December 16.1 POSIX 268
16.1.1 POSIX specification 268
16.1.2 POSIX character group 269
16.2 VI 271
16.2.1 character groups and shorthand 271
16.2.2 quantifiers 272
16.2.3 multiple-choice structure and capture group 272
16.2.4 Huanshi 273
16.2.5 anchor points and word boundaries 273
Special Character 274 for the 16.2.6 Replacement Operation
Special variable 276 in 16.2.7 replacement
16.2.8 supplement 276
16.3 grep 277
16.3.1 basic usage 277
16.3.2 character group 277
16.3.3 anchor points and word boundaries 278
16.3.4 quantizer 278
16.3.5 multiple-choice structure and capture group 279
16.3.6 options 279
16.3.7 egrep & fgrep 280
16.3.8 supplement 280
16.4 awk 281
16.4.1 basic use 281
16.4.2 character groups and shorthand 282
16.4.3 anchor points and word boundaries 283
16.4.4 quantifiers 283
16.4.5 multiple choice structure 284
Supplement 16.4.6 284
16.5 sed 284
16.5.1 basic use 284
16.5.2 character groups and shorthand 285
16.5.3 anchor points and word boundaries 285
16.5.4 quantifiers 286
16.5.5 multiple structure and capture group 286
16.5.6 options 286
16.5.7 supplement 287
16.6 Conclusion 288
Appendix A general features of common languages 291
Appendix B common Regular Expression 293
Appendix C Common Regular Expression tools and resources 309PrefaceWhen it comes to regular expressions, many people are a little dismissive: This is not always useful, so why spend time learning?
Yes, regular expressions are not "always used", but they are not used when necessary, which often leads to the embarrassment of "A penny is a hero. Programmers who often need to process text will naturally know the value of regular expressions. If other programmers do not have regular expressions, even if the development field has nothing to do with text processing, it is also inevitable that the fate of "lying down and shot"-I encountered a problem a few days ago, split a long line of address into multiple lines, responsible for the daily work of this part of the programmer is just to make a PDF, the split address is a very "edge" function, but it cannot be accurately folded without a regular expression (it is generally necessary to fold the line where the punctuation mark appears, rather than just a blank character, however, punctuation marks in different languages are different,Computer booksIf you understand regular expressions, you can easily process punctuation characters in various languages.
From my development experience, it is really necessary to spend some time mastering regular expressions. There are many books and materials about regular expressions, but they have their own shortcomings.
On the Internet, there are some regular documents in programming languages and posts such as "30 minutes to teach you regular expressions. The advantage of such materials is that they are simple and direct. If there are ready-made examples and are suitable for your own language, they can be used directly. However, the disadvantage is that they are simple and direct, there is no explanation of the principles behind the scenes. If you cannot find an existing example or an example that can work in your own language (you need to know, the same regular expression cannot be applied directly to different languages.
In the official publishing field, there are already "proficient in regular expressions", "Must know regular expressions", and so on.BooksPublishing, especially the former, is a classic book on regular expressions. To learn Regular Expressions carefully, such books must be read. However, this type of books also has a weakness, that is, they are all translated from English versions. They focus more on English Text Processing. As a developer in the Chinese world, we often need to process Chinese Text-regular expressions provide rich enough functions for processing characters other than English, but there is little information about how to use and use these functions properly.
I often need to explain the knowledge of regular expressions to people. I often regret that developers are troubled by these problems, the motivation for writing this book is to make up for the defects of existing materials.
Compared with regular documents and fast-paced teaching posts, this book provides an in-depth explanation of the principles behind matching. It will often tell readers why this is written and what structure will be caused if it is changed to another form; in addition, the similarities and differences between regular expressions in multiple languages are explained and compared, so that readers can easily "transplant" existing regular expressions to their work environments.
Source: Interactive publishing network http://www.china-pub.com/