Javascript - RegExp

RegExp

- Creation

var regExp = /…/g;

var regExp = new RegExp (“…”, ‘g’);

- Switches

Three letter could be used to create a regular expresion:

g: global, multi-match

i: ignore case, case-insentive

m: mullti-line mode, ‘^$’ matches each line once

- Properties

global: if ‘g’ is set, return true

ignoreCase: if ‘i’ is set, return true

multiline: if ‘m’ is set, return true

source: return the source string

- Methods

regexp.exec(string)

regexp.test(string)

string.match(regexp)

string.replace(regexp, replaceValue)

string.search(regexp) // return a number

string.split(regexp, limit)