JavaScript regular expressions

Since I always seems to be looking up the syntax for JavaScript regular expressions I will document it right here.

var regexp_obj = /Foo (Bar)/; if (array = regexp_obj.exec(string)) { alert("It matched!"); } else { alert("Sorry no match!"); }
new_string = string.replace(/foo/ig,"bar"); Or lots more documenation on the regexp syntax here.


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.235.85.115
To prevent spam please submit by clicking the kitten: