Temat: grep, cyfy, liczby, spacje
może to ci pomoże:
explanation
---
(\d{1,9})(\d{3}(,\d{2})?)$
Options: Case insensitive; Free-spacing; Dot doesn’t match line breaks
Match the regex below and capture its match into backreference number 1 «(\d{1,9})»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{1,9}»
Between one and 9 times, as many times as possible, giving back as needed (greedy) «{1,9}»
Match the regex below and capture its match into backreference number 2 «(\d{3}(,\d{2})?)»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{3}»
Exactly 3 times «{3}»
Match the regex below and capture its match into backreference number 3 «(,\d{2})?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match the character “,” literally «,»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{2}»
Exactly 2 times «{2}»
Assert position at the end of a line (at the end of the string or before a line break character) (carriage return and line feed pair, sole line feed, sole carriage return, vertical tab, form feed, next line, line separator, or paragraph separator) «$»
$1 $2
Insert the text that was last matched by capturing group number 1 «$1»
Insert the character “ ” literally « »
Insert the text that was last matched by capturing group number 2 «$2»
=====
explanation2
---
(\d{1,9})(\d{3})\s(\d{3})
Options: Case insensitive; Free-spacing; Dot doesn’t match line breaks
Match the regex below and capture its match into backreference number 1 «(\d{1,9})»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{1,9}»
Between one and 9 times, as many times as possible, giving back as needed (greedy) «{1,9}»
Match the regex below and capture its match into backreference number 2 «(\d{3})»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{3}»
Exactly 3 times «{3}»
Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, zero-width space) «\s»
Match the regex below and capture its match into backreference number 3 «(\d{3})»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{3}»
Exactly 3 times «{3}»
$1 $2 $3
Insert the text that was last matched by capturing group number 1 «$1»
Insert the character “ ” literally « »
Insert the text that was last matched by capturing group number 2 «$2»
Insert the character “ ” literally « »
Insert the text that was last matched by capturing group number 3 «$3»