This commit is contained in:
Ilya Kantor 2019-08-21 12:32:58 +03:00
parent 047ebc8bb8
commit 3ed1024ae7
2 changed files with 13 additions and 6 deletions

View file

@ -1,10 +1,16 @@
# Patterns and flags
Regular expressions is a powerful way to search and replace in text.
In JavaScript, they are available as `RegExp` object, and also integrated in methods of strings.
## Regular Expressions
A regular expression (also "regexp", or just "reg") consists of a *pattern* and optional *flags*.
There are two syntaxes to create a regular expression object.
The long syntax:
The "long" syntax:
```js
regexp = new RegExp("pattern", "flags");