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 MoreTag Archives: regular-expressions
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 MoreRoman numerals in JavaScript
Some years ago I developed a small Action Script 3 class to work with Roman numerals using regular expressions. As ActionScript is barely used on these days, I decided to port this class to JavaScript.
Read More