Regular Expression in Javascript – released.
The Book Regular Expression In Javascript has been released. It has been competitively priced at $30. The book makes it easy for the beginners to understand a relatively complex subject like regular expression.
Numerous exercise questions have been covered in this book. This helps reader to stress his intellect to find answer. This helps him memorize some of the facts. The contents of the book are as follows.
Table of Contents
1 Regular Expression in Javascript – Getting Started 6
1.1 Your First Regular Expression Script 6
1.2 Anchoring 8
1.3 Matching End of Subject 9
1.4 Question Set 1 10
1.5 Number of Occurrences using + 10
1.6 Number of Occurrences using ? 11
1.7 Number of Occurrences using * 12
1.8 Number of Occurrences using curly bracket {} 13
1.9 Question Set 2 15
1.10 More complex Patterns with combination of meta-characters 16
1.11 Question Set 3 17
1.12 Alternation Matches 17
1.13 A note on Eager Match 18
1.14 Character sets 18
1.15 Question Set 4 21
1.16 An alternate way of expressing pattern 22
1.17 Special Note for Empty Regular Expression 23
1.18 Negated Character Class. 23
1.19 More Character Classes 26
1.20 Difference in the use of Two methods of expression Regular Expressions 28
1.21 Question Set 5 32
1.22 Word Boundary 32
1.23 Matching a non Boundary \B 34
1.24 Limiting the Length of Input text 36
1.25 Unicodes 39
1.26 Character, Code Point and Grapheme 45
1.27 Question Set 6 46
1.28 Explanation to selected questions 49
2 Regular Expression Methods 50
2.1 Replace Method 50
2.2 Practical Example of replace – Remove Leading and Trailing Whitespace 51
2.3 Regular Expression Flags 52
2.4 Global Flag g 52
2.5 Ignore Case Flag i 53
2.6 Character Escaping 55
2.7 Question Set 1 55
2.8 Grouping 57
2.9 Backreference 61
2.10 Replace Method and Character Replacement Text 64
2.11 A Practical Example – Interchange first and last name 65
2.12 Function as a parameter to replace method 65
2.13 Non Capturing Group 67
2.14 The match method 67
2.15 Match in global mode 68
2.16 Split Method 69
2.17 Grouping in conjunction with Replace Method 69
2.18 Exec method 71
2.19 Finding the position and length 71
2.20 A Valid US zip code 72
2.21 A Valid U.K. Postcode 73
2.22 A Valid Canadian Postal Code 73
2.23 A Valid email address 74
2.24 A Valid US Date 74
2.25 A Valid US Phone Number 75
2.26 Valid Integer 75
2.27 Valid US Social Security Number 76
2.28 Valid Time 76
2.29 A Valid dollar amount 77
2.30 A Valid Credit Card Number 77
2.31 Luhn Algorithm 83
2.32 Questions and Answers 84
2.33 Answers to Questions 87
2.34 Explanation to selected Questions 87
3 Regular Expression Applications 89
3.1 Extract the filename from complete path 89
3.2 Remove HTML Tags 90
3.3 Solving Equation 91
3.4 Nested Grouping 96
4 Advanced Topics and Examples 98
4.1 Greedy Vs Lazy 98
5 Appendix A Javascript Introduction 101
5.1 What is JavaScript ? 101
5.2 Difference between Java and Javascript 101
5.3 Your First Hello World Javascript 102
5.4 Browsers that do not support JavaScript 102
5.5 Javascript Statements and Comments 103
5.6 Javascript Statements 103
5.7 Javascript Code 103
5.8 Javascript Comments 104
5.8.1 Multiline Comments 104
5.8.2 Comments at the end of Line 105
5.9 Javascript Variables and Operators 106
5.10 Javascript Rectangle Area Example 106
5.11 JavaScript Variables 106
5.12 Declaring JavaScript Variables 107
5.13 Arithmetic and Assignment Operators 108
5.14 Increment and decrement operators 109
5.15 Assignment operators 110
5.16 Comparison Operators and if else 111
5.17 Conditional Statements 112
5.18 Javascript switch statement 113
5.19 Javascript switch statement 114
5.20 Javascript Pop up Boxes 115
5.21 Alert Box 115
5.22 Javascript Confirm Box 116
5.23 Confirm Box – Another Example – Directing to another link 117
5.24 Javascript Prompt Box 118
5.25 For Loop 118
5.26 While Loop 121
5.27 Javascript Functions 122
5.28 When not to Use Functions 124
5.29 Javascript Break and Continue statements 124
5.30 Break statements 125
5.31 Continue statements 125
5.32 Javascript for..in statements 126
5.33 Javascript Events 127
5.34 onload event 127
5.35 OnMouseOver event 128
5.36 Javascript Objects – Introduction 129
5.37 Properties 129
5.38 Javascript Objects – Object Template 130
5.39 Javascript Objects – Method 132
5.40 Javascript In Built Objects 134
5.41 Javascript Date Objects 135
5.42 Methods on Date Object 135
5.43 Javascript Array 137
5.44 Javascript Quiz 138
6 Appendix B Tools for Regular Expression 145
6.1 RegexPal 145
6.2 Lars Olav Torvik’s Online Regex Tool 145
6.3 reAnimator 145
6.4 Firebug 145
7 References 147
8 Index 148
