- logical comparison
- operator precedence
- Js break continue
- with void statement
- reserved keywords
- HTML DOM Nodes
- document object
- write document
- DOM node properties
- jscript create nodes
- jScript dom attribute
- window open/close
- Window Object
- window print method
A regular expression describes one or more strings to match when you search a body of text.The regular expression serves as a character pattern to compare with the text that is being searched.
you construct a regular expression in one of two ways.
- using a regular expression literal, as follows:
var pattern = /expression/
- calling the constructor function of the regExp object:
var pattern = new regExp('ab+c');
some example of regular expression pattern:
character classes : the notation  can be used to define a pattern that represents a set of characters, called a character class.
characters enclosed in a bracket expression match only a single character for the position in the regular expression where the bracket expression appears.
var pattern = /[xyz]/g; //g flag for global search
the - character is used to specify intervals inside the  notation.the following regular expression is equivalent to /number/.
var pattern = /number[1-5]/g ;
You can also find all characters that are not in a list or range by including the caret (^) character at the start of the list
If the caret(^) character appears in any other position in the list, it matches itself; that is, it has no special meaning.
var pattern = /number[^1-5]/g ;
note: the metacharacters $, ., ?, +, (, ) and | are have not special meaning in a  construct.
|[abc]||a, b, c|
|[^abc]||any character except a, b, or c|
|[a-za-z]||a through z or a through z, inclusive (range)|
matching any character
the period(.) matches any single printing or non-printing character in a string except a newline character(/n).
The following table contains a list of multiple-character metacharacters and their behavior in regular expressions.
|.||any character except newline|
|\w||any word character. same as [a-za-z0-9]|
|\W||any non-word character. same as [^a-za-z0-9]|
|\s||any whitespace character. same as [\t\n\r\f\v]|
|\s||any non-whitespace character. same as [^ \t\n\r\f\v]|
|\d||any digit. same as [0-9]|
|\d||any non-digit. same as [^0-9]|
|\b||matches a word boundary, that is the position between a word and a space.|
|\b||matched a word non-boundary|
the boundary matchers(anchors ^/$) can be used to finding a pattern match at either the beginning or the end of a string/line.
var str = "#what is your name ?"; var pattern = /?$/; var pattern_1 = /^#/; document.write("match end of string____"+str.match(pattern)); document.write("match start of string____"+str.match(pattern_1));
quantifiers are powerful operators that repeatedly try to match a regular expression with the remaining characters in the input.
- r?, that matches the regular expression r zero or one time.
- r*, that matches the regular expression r zero or more times.
- r+, that matches the regular expression r one or more time.
var str = "what is aa that so are ss ssss aaaa is good"; var firstpattern = /a*a/g; var secondpattern = /s+/g; document.write("match zero or more time____"+str.match(firstpattern)); document.write('<br/>'+"match one or more time____"+str.match(secondpattern));