en.javascript.info/10-regular-expressions-javascript/6-regexp-greedy-and-lazy/1-lazy-greedy/solution.md
2015-04-07 15:22:06 +03:00

6 lines
No EOL
502 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Результат: `123 456`.
Ленивый `\d+?` будет брать цифры до пробела, то есть `123`. После каждой цифры он будет останавливаться, проверять -- не пробел ли дальше? Если нет -- брать ещё цифру, в итоге возьмёт `123`.
З в дело вступит `\d+`, который по-максимуму возьмёт дальнейшие цифры, то есть `456`.