Create your blog and photo album with postbit
Create your blog and photo album

Create new post

Content:

Upload a picture:
Tags (keywords separated by comma)

Save Cancel
The JavaScript Blog js:   Followers: 3 ; Following: 3

Explore The JavaScript Blog's photo albums:
Photos from posts (7)
Javascript tools (2)

Find and Replace with JavaScript


How to do a find and replace using javascript?

When you have a text where you need to do some find and replace, try this web application in JavaScript where you can paste your text, type the words to be found and replaced and click "go" to view the results of the find and replace:
 
Online find and replace tool: http://js.do/samples/find-and-replace

It works also with regular expressions. The source code is available to be viewed and changed online.

The main code uses "new RegExp" and ".replace()" javascript functions, like this:
 

var str = "this is the original string";
var re = new RegExp("original string", "g");
var str_replaced = str.replace(re, "replaced string");	

Created with js.do - Online Javascript Editor
 
 

Post by The JavaScript Blog (2012-11-15 19:34)

Post your comment:

Name: Email: Site:




| Explore users | New posts | Create your blog | Create your photo album |
| About Postbit | Our blog | Terms of use | Contact Postbit |


Copyright © 2017 - postbit.com