My Blog

    • Sample Page
Illustration of a bird flying.
  • Greedy and Lazy Quantifiers

    There are two operation modes for quantifiers in JavaScript. In this chapter, we will see how the search works with greedy and lazy quantifiers. Imagine you have a text and need to replace all the quotes “…” with guillemet marks «…». For instance, “Welcome to W3Docs”, must become «Welcome to W3Docs». Here, the first step should be locating the quoted strings and then replacing them. At…

    October 28, 2022
  • JavaScript Sets and ranges […]

    Let’s get deeper into the details of regular expressions. In this chapter, we will show you how to use sets and ranges in JavaScript. Putting several characters or character classes inside square brackets allows searching for any character among the given. To be precise, let’s consider an example. Here, [lam] means any of the given three characters ‘l’, ‘a’,…

    October 28, 2022
  • Escaping, Special Characters

    The escape function is a global object property. It figures a new string where particular characters are replaced by a hexadecimal escape sequence. The special characters are usually encoded by using the exception of @*_+-./. They are used mainly for doing more powerful searches. The full list of the special characters looks as follows: [ \ ^ $ . | ?…

    October 28, 2022
  • Word Boundary: \b

    The word boundary \b corresponds to positions when one of the sides is a word character, and the other one is not. Word boundaries are especially handy when it is necessary to match a sequence of letters or digits on their own. Or it is useful when you want to ensure that they happen at the start…

    October 28, 2022
  • Multiline Mode of Anchors ^ $, Flag “m”

    In this chapter, you will learn when and how to use the multiline mode of the anchors in JavaScript. The multiline property is a read-only property of an individual regexp instance. It specifies whether or not the m flag is applied inside the regexp. So, for enabling the multiline mode the m flag is used. The value of the multiline property is boolean:…

    October 28, 2022
  • Anchors: string start ^ and end $

    In JavaScript, the anchors are the caret ^ and the dollar $ characters, having a specific meaning in a regular expression. The caret corresponds at the beginning of the text and the dollar- at the end. For example, let’s check whether the text begins with Welcome: The pattern ^Welcome means that the string starts and then Sarah. In another example, let’s check whether the text ends with…

    October 28, 2022
  • Unicode: flag “u” and class \p{…}

    JavaScript applies Unicode encoding for strings. The majority of the characters are encoded with two bytes, but it allows representing at most 65536 characters. However, the range is not large enough for encoding all the possible characters. For that reason, several rare characters are encoded with four bytes. The Unicode values for some characters are represented below: Character…

    October 28, 2022
  • Character Classes

    Character classes are used for distinguishing characters like distinguishing between digits and letters. Let’s start from a practical case. Imagine you have a phone number like +3(522) -865-42-76, and wish to turn it into pure numbers (35228654276). To meet that goal, it is necessary to find and remove everything that’s not a number.Character classes are…

    October 28, 2022
  • Patterns and Flags

    Regular expressions are the patterns, providing a robust means of searching and replacing in the text. They are available via the Regexp object in JavaScript. Also, they are integrated into the methods of strings. Regular Expressions A regular expression ( or a “regexp”, “regex”, “reg”) encompasses a pattern and optional flags. Two syntaxes (long and short) are used for…

    October 28, 2022
  • Simple Share

    Intro As you can guess, this chapter will teach you how to create Facebook Simple Share button. At first, we must talk about creating a Facebook App. When you create an App, you will get its Id (App ID) and will use it on your webpage. Let’s see what we must do for the beginning.…

    October 28, 2022
←Previous Page
1 … 26 27 28 29 30 … 113
Next Page→

My Blog

Proudly powered by WordPress