Example discussed in the previous tutorial about Javascript replace function shows how to substitute all the occurrences of specified string pattern with new string pattern or character. That example performs the replace action with case sensitive approach by default. To extend the behavior of javascript string replace function there is another option “i” likewise we used “g” in the previous tutorial. The character “i” enables the JavaScript Replace string function to perform the case insensitive search in the given string and replaces the specified string pattern or character with new pattern. Here is an example:

Example For case insensitive javascript replace function

var myString = new String();

myString = "Case Insensitive Example";

document.write(myString.replace(/example/i," Replace Example"));
Output

Case Insensitive Replace ExampleYou can perform replace string pattern actions by using different combinations of options such as “gi” for replacing all the occurrence of specified string pattern along with case insensitive find and replace sequence.

Continue to next tutorial: Javascript RegExp Replace String Function to learn how to replace the specified regular expression matched pattern from a string.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.