str_replace PHP function in JavaScript

Working with JavaScript, if one wants to replace a part of a string with another string, usually, the replace String method is used. This method allows to manipulate a string using another string or a regular expression. Next it is shown how it is used:

Read More »

Full-text search in JavaScript

There is a newer post with a better method to perform a full-text search in JavaScript.

Some time ago, I needed to create a full-text search in JavaScript in a project that I was working on. The requirement was to search the text directly in the DOM modifying it and highlighting the relevant results.

The majority of the scripts on the internet, explain how to search a text inside a string, but many of them focused on verifying if the text is present or not, using for it the indexOf or the search methods of the String object.

Read More »