Learn RegEx in 5 minutes | Beginner Tutorial Regular Expressions with JavaScript

preview_player
Показать описание
In this video I will explain the very basic of regular expressions.
Рекомендации по теме
Комментарии
Автор

Watch out! The following regex will validate to true:
/a{1, 2}/.test('aaa');
... although there is clearly a maximum of 2 set. The reason is that regexes do not care about what else in the string exist as long as they match.
However, this is not the case if there are more characters before and after the string, for example:
/xa{1, 2}x/.test('xaaax');
This will validate to false !

timoernst
Автор

Question: I have the following regex and text and i would like to match all doubles. However when I try to match them all it skips the 2nd line. How come? Note i am working in bash via mac terminal.
what flags should i used besides -o and -i
([a-z]+) +\1
Paris in the the spring.
The theoretical viewpoint is of little value here.
I view the theoretical viewpoint as being of little value here.
I think that that is often overdone.
This sentence contains contains a doubled word or two two.
Fear fear is a fearful thing.
Writing successful programs requires that the the programmer fully understands the
problem to be solved.

Captinofthemudslayer