ebook img

Practice Makes Regexp PDF

206 Pages·5.868 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Practice Makes Regexp

Practice Makes Regexp 50 exercises to help you master regular expressions Reuven M. Lerner, PhD Contents Preface: Practice Makes Regexp 1 About me 2 Acknowledgements Chapter 1 Regexp use from programming languages 1.1 Python 1.1.1 Defining regexps 1.1.2 Finding one 1.1.3 Finding more than one 1.1.4 Substituting text 1.1.5 Flags 1.1.6 Advanced features 1.1.7 More information 1.1.8 About Python solutions 1.2 Ruby 1.2.1 Defining regexps 1.2.2 Finding one 1.2.3 Finding more than one 1.2.4 Substituting text 1.2.5 Flags 1.2.6 Advanced features 1.2.7 More information 1.2.8 About Ruby solutions 1.3 JavaScript 1.3.1 Defining regexps 1.3.2 Finding one or more 1.3.3 Substituting text 1.3.4 Advanced features 1.3.5 More information 1.3.6 About JavaScript solutions 1.4 PostgreSQL 1.4.1 Defining regexps 1.4.2 True/false operators 1.4.3 Extracting text 1.4.4 Splitting 1.4.5 More information 1.5 grep 1.5.1 Basic use 1.5.2 Backslashes 1.5.3 Context Chapter 2 Input data 2.1 Dictionary (words.txt) 2.2 Alice in Wonderland (alice.txt) 2.3 Config (config.txt) 2.4 Apache logfile (access-log.txt) 2.5 Linux “passwd” file (passwd.txt) 2.6 Fakelog (fakelog.txt) 2.7 PostgreSQL database Chapter 3 Exercises 3.1 Simple regexps 3.1.1 Find matches 3.1.2 Five-letter words 3.1.3 Double “f” in the middle 3.1.4 Extract timestamp 3.2 Character classes 3.2.1 End-of-sentence words 3.2.2 Hex numbers 3.2.3 Hexwords 3.2.4 IP addresses 3.2.5 Long, weird words 3.2.6 Matching URLs 3.2.7 Non-zero hours 3.2.8 Quoted text 3.2.9 Supervocalic 3.2.10 Double triple vowel 3.2.11 Postfix dollar 3.3 Alternation 3.3.1 Multiple date formats 3.3.2 “oo” and “ee” words 3.3.3 British and American spelling 3.4 Anchors 3.4.1 Capital vowel starts 3.4.2 Comment lines 3.4.3 Last five characters 3.4.4 u in the 2nd-to-last word 3.5 Groups 3.5.1 Date and time 3.5.2 Config pairs 3.5.3 Quote first and last words 3.5.4 Prices with symbols 3.5.5 Question first word 3.5.6 t, but no “ing” 3.5.7 Usernames and user IDs 3.5.8 Beheaded usernames 3.5.9 Final question words 3.5.10 “d” user shells 3.6 Flags 3.6.1 All usernames 3.6.2 abc 3.6.3 abcABC 3.6.4 abcABC, extended 3.6.5 No-error IP addresses 3.7 Backreferences 3.7.1 Doubled vowels 3.7.2 Hours and seconds 3.7.3 Seven-letter start-finish words 3.7.4 end-start 3.7.5 Singular and plural 3.8 Replace 3.8.1 Crunch whitespace 3.8.2 New hostname 3.8.3 Detagify 3.8.4 Deunixify paths 3.9 Unix command line 3.9.1 Disk space 3.9.2 Not-today files 3.9.3 Problem logs 3.9.4 Old and new Office files Chapter 4 Simple regexps 4.1 Find matches 4.1.1 Solution 4.1.2 Python 4.1.3 Ruby 4.1.4 JavaScript 4.1.5 PostgreSQL 4.2 Five-letter words 4.2.1 Solution 4.2.2 Python 4.2.3 Ruby 4.2.4 JavaScript 4.2.5 PostgreSQL 4.3 Double “f” in the middle 4.3.1 Solution 4.3.2 Python 4.3.3 Ruby 4.3.4 JavaScript 4.3.5 PostgreSQL 4.4 Extract timestamp 4.4.1 Solution 4.4.2 Python 4.4.3 Ruby 4.4.4 JavaScript 4.4.5 PostgreSQL Chapter 5 Character classes 5.1 End-of-sentence words 5.1.1 Solution 5.1.2 Python 5.1.3 Ruby 5.1.4 JavaScript 5.1.5 PostgreSQL 5.2 Hex numbers 5.2.1 Solution 5.2.2 Python 5.2.3 Ruby 5.2.4 JavaScript 5.2.5 PostgreSQL 5.3 Hexwords 5.3.1 Solution 5.3.2 Python 5.3.3 Ruby 5.3.4 JavaScript 5.3.5 PostgreSQL 5.4 IP addresses 5.4.1 Solution 5.4.2 Python 5.4.3 Ruby 5.4.4 JavaScript 5.4.5 PostgreSQL 5.5 Long, weird words 5.5.1 Solution 5.5.2 Python 5.5.3 Ruby 5.5.4 JavaScript 5.5.5 PostgreSQL 5.6 Matching URLs 5.6.1 Solution 5.6.2 Python 5.6.3 Ruby 5.6.4 JavaScript 5.6.5 PostgreSQL 5.7 Non-zero hours 5.7.1 Solution 5.7.2 Python 5.7.3 Ruby 5.7.4 JavaScript 5.7.5 PostgreSQL 5.8 Quoted text 5.8.1 Solution 5.8.2 Python 5.8.3 Ruby 5.8.4 JavaScript 5.8.5 PostgreSQL 5.9 Supervocalic 5.9.1 Solution 5.9.2 Python 5.9.3 Ruby 5.9.4 JavaScript 5.9.5 PostgreSQL 5.10 Double triple vowel 5.10.1 Solution 5.10.2 Python 5.10.3 Ruby 5.10.4 JavaScript 5.10.5 PostgreSQL 5.11 Postfix dollar 5.11.1 Solution 5.11.2 Python 5.11.3 Ruby 5.11.4 JavaScript 5.11.5 PostgreSQL

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.