Last week I was struggling with string replace function.The requirement was strange but its not in scope of this post. After spending one whole day and achieving the requirement, I have decided to club all the possible usage of replace funcation. lets start with the simplest form of Replace function. var str = "The world is beautiful, just you need beautiful heart"; str = str.replace('beautiful', 'lovely'); In above replace call, the first only occurrence of beautiful will be replaced by heart . The resultant string will be " The world is lovely, just you beautiful heart ." The Replace() function has two arguments string or regex to be replaced string or function[that return string] to be in placed. we'll look in every possible scenarios. Now if I want to make my replace function case insensitive, I do have to make little bit modification. as follows var str = "The world is Beautiful, just you need Beautif
JavaScript to Java and .Net ........!