remove cut

This commit is contained in:
Ilya Kantor 2018-02-06 13:07:22 +03:00
parent 37f1936622
commit be007e78ef
99 changed files with 0 additions and 198 deletions

View file

@ -6,8 +6,6 @@ In JavaScript regular expressions are implemented using objects of a built-in `R
Please note that regular expressions vary between programming languages. In this tutorial we concentrate on JavaScript. Of course there's a lot in common, but they are a somewhat different in Perl, Ruby, PHP etc.
[cut]
## Regular expressions
A regular expression (also "regexp", or just "reg") consists of a *pattern* and optional *flags*.

View file

@ -7,8 +7,6 @@ There are two sets of methods to deal with regular expressions.
The structure is a bit messed up, so we'll first consider methods separately, and then -- practical recipes for common tasks.
[cut]
## str.search(reg)
We've seen this method already. It returns the position of the first match or `-1` if none found:

View file

@ -4,8 +4,6 @@ Consider a practical task -- we have a phone number `"+7(903)-123-45-67"`, and w
A character class is a special notation that matches any symbol from the set.
[cut]
For instance, there's a "digit" class. It's written as `\d`. We put it in the pattern, and during the search any digit matches it.
For instance, the regexp `pattern:/\d/` looks for a single digit:

View file

@ -2,8 +2,6 @@
Several characters or character classes inside square brackets `[…]` mean to "search for any character among given".
[cut]
## Sets
For instance, `pattern:[eao]` means any of the 3 characters: `'a'`, `'e'`, or `'o'`.

View file

@ -4,8 +4,6 @@ Quantifiers are very simple from the first sight, but in fact they can be tricky
We should understand how the search works very well if we plan to look for something more complex than `pattern:/\d+/`.
[cut]
Let's take the following task as an example.
We have a text and need to replace all quotes `"..."` with guillemet marks: `«...»`. They are preferred for typography in many countries.

View file

@ -7,8 +7,6 @@ That has two effects:
1. It allows to place a part of the match into a separate array item when using [String#match](mdn:js/String/match) or [RegExp#exec](mdn:/RegExp/exec) methods.
2. If we put a quantifier after the parentheses, it applies to the parentheses as a whole, not the last character.
[cut]
## Example
In the example below the pattern `pattern:(go)+` finds one or more `match:'go'`:

View file

@ -2,8 +2,6 @@
Capturing groups may be accessed not only in the result, but in the replacement string, and in the pattern too.
[cut]
## Group in replacement: $n
When we are using `replace` method, we can access n-th group in the replacement string using `$n`.

View file

@ -4,8 +4,6 @@ Alternation is the term in regular expression that is actually a simple "OR".
In a regular expression it is denoted with a vertical line character `pattern:|`.
[cut]
For instance, we need to find programming languages: HTML, PHP, Java or JavaScript.
The corresponding regexp: `pattern:html|php|java(script)?`.

View file

@ -2,8 +2,6 @@
The caret `pattern:'^'` and dollar `pattern:'$'` characters have special meaning in a regexp. They are called "anchors".
[cut]
The caret `pattern:^` matches at the beginning of the text, and the dollar `pattern:$` -- in the end.
For instance, let's test if the text starts with `Mary`:

View file

@ -2,8 +2,6 @@
The multiline mode is enabled by the flag `pattern:/.../m`.
[cut]
It only affects the behavior of `pattern:^` and `pattern:$`.
In the multiline mode they match not only at the beginning and end of the string, but also at start/end of line.

View file

@ -10,8 +10,6 @@ That may even be a vulnerability. For instance, if JavaScript is on the server,
So the problem is definitely worth to deal with.
[cut]
## Example
The plan will be like this: