Blog Archive for March 18, 2010

Regular Expressions in JavaScript

March 18, 2010

Here's some code examples for working with regular expressions in JavaScript (with a bit of jQuery thrown in for good measure)

Search and Replace

Here's an example of looking for matches to a regex and replacing. The $1 in the replace refers to the string that matched.

$('#testbutton' …