Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 8c34c77b3e
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (24 sloc) 0.666 kB
<faq xmlns:js="">
How do I use regular expressions in JavaScript.
Use the replace method on a string and note
that it returns a new string (i.e. doesn't
modify the contents of the string on which the
replace method is called).
You can do simple replacements such as
var str = "a foo is not a bar";
ans = str.replace("foo", "boo");
For regular expressions, you can use
var re = new RegExp("pattern", "modifiers");
str.replace(re, "other text");
See legend.js in tests/ for dealing with CSS-based style attributes
which contain all the sub-attributes.
Jump to Line
Something went wrong with that request. Please try again.