Answer the question
In order to leave comments, you need to log in
I can't compose a regular expression, what am I doing wrong?
Good afternoon.
Need help, already broke my head.
There is a list:
fb.ru
avto.ru
solitaire.classicgame.klondike.solitaire.freecard
solitaire.patience.card.games.klondike.free
blabla.ru
tadasuda.ru
From this list, you need to select the following lines according to the model of
solitaire.classicgame.klondike .solitaire.freecard
solitaire.patience.card.games.klondike.free
They can be shorter or longer but generally there are always 3-4 dots in the text.
Tried:
[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+
\w+ .\w+.\w+.\w+
and many other options, please help with composing a regular expression.
Answer the question
In order to leave comments, you need to log in
Thanks to all.
The option (\w+\.){3,}\w+ came up the most,
so I thought of the option, go from the opposite, minus at the end in the .ru .com domain zone, etc.
if you need to take 3 or 4 points, then first make an expression for 2 points, and then use the OR construction, which is also an alternation that will take the next 1 or 2 points.
[a-zA-Z0-9]+\.[a-zA-Z0-9]+ (\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[ a-zA-Z0-9]+)
https://regex101.com/r/10ZqvF/1
Here, for example, about this:
https://learn.javascript.ru/regexp-alternation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question