Page tree

This page has not yet been translated to English (United States).

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sv translation
languageen_US


A brief introduction to syntax of regular expressions:


Metacharacters - characters with special meaning

CharacterMeaning
( )groups the characters inside to one group
^beginning of the string or beginning of the line
$end of the string or end of the line
[ ]groups the characters class
.any one character (except new line character \n)
{ }specify the repeat range of the previous symbol
\following character is not metacharacter of regex but regular character
|OR - dividing possible variants



Quantifiers - with their help is possible to specify number of repetitions of certain character or group of characters

QuantifierMeaning
*0 or more occurrences of previous character
+1 or more occurrences of previous character
?0 or 1 occurrence of previous character
{NUMBER}occurrence of previous character equals NUMBER in brackets
{MIN,}occurrence of previous character at least MIN times
{MIN, MAX}occurrence of previous character at least MIN times and most MAX times


Examples of creation of simpler regular expressions can be found here: https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285

Note

If you want to know more about construction of regular expressions, you can use e.g. this documentation.