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.
Leave A Reply
All content licensed under the Creative Commons License