Repository navigation
Expand file tree
/
Copy pathregex.po
More file actions
2639 lines (2307 loc) · 147 KB
/
Copy pathregex.po
File metadata and controls
2639 lines (2307 loc) · 147 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Dmytro Kazanzhy, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-25 14:19+0000\n"
"PO-Revision-Date: 2021-06-28 00:53+0000\n"
"Last-Translator: Dmytro Kazanzhy, 2025\n"
"Language-Team: Ukrainian (https://app.transifex.com/python-doc/teams/5390/"
"uk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: uk\n"
"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != "
"11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % "
"100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || "
"(n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
msgid "Regular Expression HOWTO"
msgstr "Регулярний вираз HOWTO"
msgid "Author"
msgstr "Автор"
msgid "A.M. Kuchling <amk@amk.ca>"
msgstr "A.M. Kuchling <amk@amk.ca>"
msgid "Abstract"
msgstr "Анотація"
msgid ""
"This document is an introductory tutorial to using regular expressions in "
"Python with the :mod:`re` module. It provides a gentler introduction than "
"the corresponding section in the Library Reference."
msgstr ""
"Цей документ є вступним посібником із використання регулярних виразів у "
"Python із модулем :mod:`re`. Він містить більш лагідний вступ, ніж "
"відповідний розділ довідника бібліотеки."
msgid "Introduction"
msgstr "Вступ"
msgid ""
"Regular expressions (called REs, or regexes, or regex patterns) are "
"essentially a tiny, highly specialized programming language embedded inside "
"Python and made available through the :mod:`re` module. Using this little "
"language, you specify the rules for the set of possible strings that you "
"want to match; this set might contain English sentences, or e-mail "
"addresses, or TeX commands, or anything you like. You can then ask "
"questions such as \"Does this string match the pattern?\", or \"Is there a "
"match for the pattern anywhere in this string?\". You can also use REs to "
"modify a string or to split it apart in various ways."
msgstr ""
"Регулярні вирази (так звані RE, або регулярні вирази, або шаблони регулярних "
"виразів) — це, по суті, крихітна вузькоспеціалізована мова програмування, "
"вбудована в Python і доступна через модуль :mod:`re`. Використовуючи цю "
"маленьку мову, ви визначаєте правила для набору можливих рядків, які ви "
"хочете зіставити; цей набір може містити англійські речення, або адреси "
"електронної пошти, або команди TeX, або будь-що, що вам подобається. Потім "
"ви можете поставити такі запитання, як \"Чи відповідає цей рядок шаблону?\" "
"або \"Чи є відповідність шаблону десь у цьому рядку?\". Ви також можете "
"використовувати RE, щоб змінити рядок або розділити його різними способами."
msgid ""
"Regular expression patterns are compiled into a series of bytecodes which "
"are then executed by a matching engine written in C. For advanced use, it "
"may be necessary to pay careful attention to how the engine will execute a "
"given RE, and write the RE in a certain way in order to produce bytecode "
"that runs faster. Optimization isn't covered in this document, because it "
"requires that you have a good understanding of the matching engine's "
"internals."
msgstr ""
"Шаблони регулярних виразів компілюються в серію байт-кодів, які потім "
"виконуються механізмом відповідності, написаним мовою C. Для розширеного "
"використання може знадобитися звернути особливу увагу на те, як механізм "
"виконуватиме заданий RE, і записати RE у певним чином, щоб створити байт-"
"код, який працює швидше. Оптимізація не розглядається в цьому документі, "
"оскільки вона вимагає, щоб ви добре розуміли внутрішні механізми "
"відповідності."
msgid ""
"The regular expression language is relatively small and restricted, so not "
"all possible string processing tasks can be done using regular expressions. "
"There are also tasks that *can* be done with regular expressions, but the "
"expressions turn out to be very complicated. In these cases, you may be "
"better off writing Python code to do the processing; while Python code will "
"be slower than an elaborate regular expression, it will also probably be "
"more understandable."
msgstr ""
"Мова регулярних виразів є відносно невеликою та обмеженою, тому не всі "
"можливі завдання обробки рядків можна виконати за допомогою регулярних "
"виразів. Також є завдання, які *можна* виконувати регулярними виразами, але "
"вирази виявляються дуже складними. У цих випадках вам може бути краще "
"написати код Python для виконання обробки; Хоча код Python буде повільнішим, "
"ніж складний регулярний вираз, він також, ймовірно, буде більш зрозумілим."
msgid "Simple Patterns"
msgstr "Прості візерунки"
msgid ""
"We'll start by learning about the simplest possible regular expressions. "
"Since regular expressions are used to operate on strings, we'll begin with "
"the most common task: matching characters."
msgstr ""
"Ми почнемо з вивчення найпростіших регулярних виразів. Оскільки регулярні "
"вирази використовуються для роботи з рядками, ми почнемо з найпоширенішого "
"завдання: зіставлення символів."
msgid ""
"For a detailed explanation of the computer science underlying regular "
"expressions (deterministic and non-deterministic finite automata), you can "
"refer to almost any textbook on writing compilers."
msgstr ""
"Для детального пояснення інформатики, що лежить в основі регулярних виразів "
"(детермінованих і недетермінованих кінцевих автоматів), ви можете звернутися "
"до майже будь-якого підручника з написання компіляторів."
msgid "Matching Characters"
msgstr "Відповідні символи"
msgid ""
"Most letters and characters will simply match themselves. For example, the "
"regular expression ``test`` will match the string ``test`` exactly. (You "
"can enable a case-insensitive mode that would let this RE match ``Test`` or "
"``TEST`` as well; more about this later.)"
msgstr ""
"Більшість літер і символів просто збігаються. Наприклад, регулярний вираз "
"``test`` точно збігатиметься з рядком ``test``. (Ви можете ввімкнути режим "
"без урахування регістру, який дозволив би цьому RE відповідати також "
"``Test`` або ``TEST``; докладніше про це пізніше.)"
msgid ""
"There are exceptions to this rule; some characters are special :dfn:"
"`metacharacters`, and don't match themselves. Instead, they signal that "
"some out-of-the-ordinary thing should be matched, or they affect other "
"portions of the RE by repeating them or changing their meaning. Much of "
"this document is devoted to discussing various metacharacters and what they "
"do."
msgstr ""
"З цього правила є винятки; деякі символи є спеціальними :dfn:"
"`metacharacters` і не відповідають самі собі. Натомість вони сигналізують "
"про те, що потрібно зіставити щось незвичайне, або впливають на інші частини "
"RE, повторюючи їх або змінюючи їх значення. Велика частина цього документа "
"присвячена обговоренню різних метасимволів і того, що вони роблять."
msgid ""
"Here's a complete list of the metacharacters; their meanings will be "
"discussed in the rest of this HOWTO."
msgstr ""
"Ось повний список метасимволів; їхнє значення буде обговорено в решті цього "
"HOWTO."
msgid ". ^ $ * + ? { } [ ] \\ | ( )"
msgstr ""
msgid ""
"The first metacharacters we'll look at are ``[`` and ``]``. They're used for "
"specifying a character class, which is a set of characters that you wish to "
"match. Characters can be listed individually, or a range of characters can "
"be indicated by giving two characters and separating them by a ``'-'``. For "
"example, ``[abc]`` will match any of the characters ``a``, ``b``, or ``c``; "
"this is the same as ``[a-c]``, which uses a range to express the same set of "
"characters. If you wanted to match only lowercase letters, your RE would be "
"``[a-z]``."
msgstr ""
"Перші метасимволи, які ми розглянемо, це ``[`` і ``]``. Вони "
"використовуються для вказівки класу символів, який є набором символів, які "
"ви хочете зіставити. Символи можна перераховувати окремо або діапазон "
"символів можна вказати двома символами та розділити їх символом ``'-'``. "
"Наприклад, \"[abc]\" відповідатиме будь-якому із символів \"a\", \"b\" або "
"\"c\"; це те саме, що ``[a-c]``, який використовує діапазон для вираження "
"того самого набору символів. Якщо ви хочете зіставити лише малі літери, "
"вашим RE буде ``[a-z]``."
msgid ""
"Metacharacters (except ``\\``) are not active inside classes. For example, "
"``[akm$]`` will match any of the characters ``'a'``, ``'k'``, ``'m'``, or "
"``'$'``; ``'$'`` is usually a metacharacter, but inside a character class "
"it's stripped of its special nature."
msgstr ""
"Метасимволи (крім ``\\``) неактивні всередині класів. Наприклад, ``[akm$]`` "
"відповідатиме будь-якому із символів ``'a'``, ``'k'``, ``'m'`` або ``'$'``; "
"``'$'`` зазвичай є метасимволом, але всередині класу символів він "
"позбавлений особливої природи."
msgid ""
"You can match the characters not listed within the class by :dfn:"
"`complementing` the set. This is indicated by including a ``'^'`` as the "
"first character of the class. For example, ``[^5]`` will match any character "
"except ``'5'``. If the caret appears elsewhere in a character class, it "
"does not have special meaning. For example: ``[5^]`` will match either a "
"``'5'`` or a ``'^'``."
msgstr ""
"Ви можете зіставити символи, яких немає в списку в класі, :dfn:"
"`complementing` набір. Це вказується додаванням ``'^'`` як першого символу "
"класу. Наприклад, ``[^5]`` відповідатиме будь-якому символу, крім ``'5'``. "
"Якщо каретка з’являється в іншому місці класу символів, вона не має "
"особливого значення. Наприклад: ``[5^]`` відповідатиме або ``'5''``, або "
"``'^'``."
msgid ""
"Perhaps the most important metacharacter is the backslash, ``\\``. As in "
"Python string literals, the backslash can be followed by various characters "
"to signal various special sequences. It's also used to escape all the "
"metacharacters so you can still match them in patterns; for example, if you "
"need to match a ``[`` or ``\\``, you can precede them with a backslash to "
"remove their special meaning: ``\\[`` or ``\\\\``."
msgstr ""
"Мабуть, найважливішим метасимволом є зворотна коса риска, ``\\``. Як і в "
"рядкових літералах Python, за зворотною скісною рискою можуть слідувати "
"різні символи, щоб позначити різні спеціальні послідовності. Він також "
"використовується для екранування всіх метасимволів, щоб ви все ще могли "
"зіставляти їх у шаблонах; наприклад, якщо вам потрібно знайти відповідність "
"``[`` або ``\\``, ви можете поставити перед ними зворотну скісну риску, щоб "
"видалити їхнє спеціальне значення: ``\\[`` або ``\\\\``."
msgid ""
"Some of the special sequences beginning with ``'\\'`` represent predefined "
"sets of characters that are often useful, such as the set of digits, the set "
"of letters, or the set of anything that isn't whitespace."
msgstr ""
"Деякі спеціальні послідовності, що починаються з ``'\\'``, представляють "
"заздалегідь визначені набори символів, які часто є корисними, наприклад "
"набір цифр, набір літер або набір будь-чого, що не є пробілами."
msgid ""
"Let's take an example: ``\\w`` matches any alphanumeric character. If the "
"regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-"
"Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the "
"characters marked as letters in the Unicode database provided by the :mod:"
"`unicodedata` module. You can use the more restricted definition of ``\\w`` "
"in a string pattern by supplying the :const:`re.ASCII` flag when compiling "
"the regular expression."
msgstr ""
"Розглянемо приклад: ``\\w`` відповідає будь-якому буквено-цифровому символу. "
"Якщо шаблон регулярного виразу виражено в байтах, це еквівалентно класу ``[a-"
"zA-Z0-9_]``. Якщо шаблон регулярного виразу є рядком, ``\\w`` відповідатиме "
"всім символам, позначеним як літери в базі даних Unicode, наданій модулем :"
"mod:`unicodedata`. Ви можете використовувати більш обмежене визначення "
"``\\w`` у шаблоні рядка, поставивши прапорець :const:`re.ASCII` під час "
"компіляції регулярного виразу."
msgid ""
"The following list of special sequences isn't complete. For a complete list "
"of sequences and expanded class definitions for Unicode string patterns, see "
"the last part of :ref:`Regular Expression Syntax <re-syntax>` in the "
"Standard Library reference. In general, the Unicode versions match any "
"character that's in the appropriate category in the Unicode database."
msgstr ""
"Наступний список спеціальних послідовностей не є повним. Щоб отримати повний "
"список послідовностей і розширених визначень класів для шаблонів рядків "
"Unicode, перегляньте останню частину :ref:`Синтаксису регулярного виразу <re-"
"syntax>` у довіднику стандартної бібліотеки. Загалом, версії Unicode "
"відповідають будь-якому символу, який знаходиться у відповідній категорії "
"бази даних Unicode."
msgid "``\\d``"
msgstr "``\\d``"
msgid "Matches any decimal digit; this is equivalent to the class ``[0-9]``."
msgstr ""
"Збігається з будь-якою десятковою цифрою; це еквівалентно класу ``[0-9]``."
msgid "``\\D``"
msgstr "``\\D``"
msgid ""
"Matches any non-digit character; this is equivalent to the class ``[^0-9]``."
msgstr ""
"Відповідає будь-якому нецифровому символу; це еквівалентно класу ``[^0-9]``."
msgid "``\\s``"
msgstr "``\\s``"
msgid ""
"Matches any whitespace character; this is equivalent to the class "
"``[ \\t\\n\\r\\f\\v]``."
msgstr ""
"Відповідає будь-якому пробілу; це еквівалентно класу ``[ \\t\\n\\r\\f\\v]``."
msgid "``\\S``"
msgstr "``\\S``"
msgid ""
"Matches any non-whitespace character; this is equivalent to the class ``[^ "
"\\t\\n\\r\\f\\v]``."
msgstr ""
"Відповідає будь-якому непробільному символу; це еквівалентно класу ``[^ "
"\\t\\n\\r\\f\\v]``."
msgid "``\\w``"
msgstr "``\\w``"
msgid ""
"Matches any alphanumeric character; this is equivalent to the class ``[a-zA-"
"Z0-9_]``."
msgstr ""
"Відповідає будь-якому буквено-цифровому символу; це еквівалентно класу ``[a-"
"zA-Z0-9_]``."
msgid "``\\W``"
msgstr "``\\W``"
msgid ""
"Matches any non-alphanumeric character; this is equivalent to the class "
"``[^a-zA-Z0-9_]``."
msgstr ""
"Відповідає будь-якому небуквено-цифровому символу; це еквівалентно класу "
"``[^a-zA-Z0-9_]``."
msgid ""
"These sequences can be included inside a character class. For example, "
"``[\\s,.]`` is a character class that will match any whitespace character, "
"or ``','`` or ``'.'``."
msgstr ""
"Ці послідовності можна включити в клас символів. Наприклад, ``[\\s,.]`` — це "
"клас символів, який відповідатиме будь-якому пробілу, або ``',''`` чи "
"``'.''``."
msgid ""
"The final metacharacter in this section is ``.``. It matches anything "
"except a newline character, and there's an alternate mode (:const:`re."
"DOTALL`) where it will match even a newline. ``.`` is often used where you "
"want to match \"any character\"."
msgstr ""
"Останнім метасимволом у цьому розділі є ``.``. Він відповідає будь-чому, "
"крім символу нового рядка, і є альтернативний режим (:const:`re.DOTALL`), де "
"він відповідатиме навіть новому рядку. ``.`` часто використовується, коли "
"потрібно знайти відповідність \"будь-якому символу\"."
msgid "Repeating Things"
msgstr "Повторення речей"
msgid ""
"Being able to match varying sets of characters is the first thing regular "
"expressions can do that isn't already possible with the methods available on "
"strings. However, if that was the only additional capability of regexes, "
"they wouldn't be much of an advance. Another capability is that you can "
"specify that portions of the RE must be repeated a certain number of times."
msgstr ""
"Здатність зіставляти різні набори символів — це перше, що можуть зробити "
"регулярні вирази, що ще не можливо за допомогою методів, доступних для "
"рядків. Однак, якби це була єдина додаткова можливість регулярних виразів, "
"вони не були б великим прогресом. Інша можливість полягає в тому, що ви "
"можете вказати, що частини RE мають повторюватися певну кількість разів."
msgid ""
"The first metacharacter for repeating things that we'll look at is ``*``. "
"``*`` doesn't match the literal character ``'*'``; instead, it specifies "
"that the previous character can be matched zero or more times, instead of "
"exactly once."
msgstr ""
"Перший метасимвол для повторення речей, які ми розглянемо, це ``*``. ``*`` "
"не відповідає буквальному символу ``'*'``; натомість він визначає, що "
"попередній символ може бути зіставлений нуль або більше разів замість точно "
"одного разу."
msgid ""
"For example, ``ca*t`` will match ``'ct'`` (0 ``'a'`` characters), ``'cat'`` "
"(1 ``'a'``), ``'caaat'`` (3 ``'a'`` characters), and so forth."
msgstr ""
"Наприклад, ``ca*t`` відповідатиме ``'ct'`` (0 символів ``'a'``), ``'cat'`` "
"(1 ``'a'``), ``'caaat'`` (3 символи ``'a'``) і так далі."
msgid ""
"Repetitions such as ``*`` are :dfn:`greedy`; when repeating a RE, the "
"matching engine will try to repeat it as many times as possible. If later "
"portions of the pattern don't match, the matching engine will then back up "
"and try again with fewer repetitions."
msgstr ""
"Такі повтори, як ``*`` є :dfn:`greedy`; при повторенні RE механізм пошуку "
"відповідності намагатиметься повторити його якомога більше разів. Якщо "
"пізніші частини шаблону не збігаються, механізм пошуку відповідностей "
"створить резервну копію та спробує знову з меншою кількістю повторень."
msgid ""
"A step-by-step example will make this more obvious. Let's consider the "
"expression ``a[bcd]*b``. This matches the letter ``'a'``, zero or more "
"letters from the class ``[bcd]``, and finally ends with a ``'b'``. Now "
"imagine matching this RE against the string ``'abcbd'``."
msgstr ""
"Покроковий приклад зробить це більш очевидним. Розглянемо вираз "
"``a[bcd]*b``. Це відповідає літері ``'a'``, нулю або більше літер з класу "
"``[bcd]`` і, нарешті, закінчується ``'b'``. Тепер уявіть, що зіставлення "
"цього RE з рядком ``'abcbd``."
msgid "Step"
msgstr "Крок"
msgid "Matched"
msgstr "Збіг"
msgid "Explanation"
msgstr "Пояснення"
msgid "1"
msgstr "1"
msgid "``a``"
msgstr "``a``"
msgid "The ``a`` in the RE matches."
msgstr "``a`` у RE відповідає."
msgid "2"
msgstr "2"
msgid "``abcbd``"
msgstr "``abcbd``"
msgid ""
"The engine matches ``[bcd]*``, going as far as it can, which is to the end "
"of the string."
msgstr ""
"Механізм збігається з ``[bcd]*``, просуваючись якомога далі, тобто до кінця "
"рядка."
msgid "3"
msgstr "3"
msgid "*Failure*"
msgstr "*Невдача*"
msgid ""
"The engine tries to match ``b``, but the current position is at the end of "
"the string, so it fails."
msgstr ""
"Механізм намагається знайти відповідність ``b``, але поточна позиція "
"знаходиться в кінці рядка, тому це не вдається."
msgid "4"
msgstr "4"
msgid "``abcb``"
msgstr "``abcb``"
msgid "Back up, so that ``[bcd]*`` matches one less character."
msgstr ""
"Зробіть резервну копію, щоб ``[bcd]*`` відповідав на один символ менше."
msgid "5"
msgstr "5"
msgid ""
"Try ``b`` again, but the current position is at the last character, which is "
"a ``'d'``."
msgstr ""
"Спробуйте ``b`` ще раз, але поточна позиція знаходиться на останньому "
"символі, який є ``'d'``."
msgid "6"
msgstr "6"
msgid "``abc``"
msgstr "``abc``"
msgid "Back up again, so that ``[bcd]*`` is only matching ``bc``."
msgstr "Знову створіть резервну копію, щоб ``[bcd]*`` відповідало лише ``bc``."
msgid ""
"Try ``b`` again. This time the character at the current position is "
"``'b'``, so it succeeds."
msgstr ""
"Спробуйте ``b`` знову. Цього разу символом у поточній позиції є ``'b'``, "
"отже, це вдалось."
msgid ""
"The end of the RE has now been reached, and it has matched ``'abcb'``. This "
"demonstrates how the matching engine goes as far as it can at first, and if "
"no match is found it will then progressively back up and retry the rest of "
"the RE again and again. It will back up until it has tried zero matches for "
"``[bcd]*``, and if that subsequently fails, the engine will conclude that "
"the string doesn't match the RE at all."
msgstr ""
"Кінець RE вже досягнуто, і він відповідає ``'abcb``. Це демонструє, як "
"система пошуку відповідностей спочатку йде так далеко, як тільки може, і "
"якщо відповідності не знайдено, вона поступово створюватиме резервні копії "
"та повторюватиме решту RE знову і знову. Він виконуватиме резервне "
"копіювання, доки не знайде нульових збігів для ``[bcd]*``, і якщо це згодом "
"не вдасться, система зробить висновок, що рядок взагалі не відповідає RE."
msgid ""
"Another repeating metacharacter is ``+``, which matches one or more times. "
"Pay careful attention to the difference between ``*`` and ``+``; ``*`` "
"matches *zero* or more times, so whatever's being repeated may not be "
"present at all, while ``+`` requires at least *one* occurrence. To use a "
"similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 "
"``'a'``\\ s), but won't match ``'ct'``."
msgstr ""
"Ще один повторюваний метасимвол – це ``+``, який збігається один або кілька "
"разів. Зверніть увагу на різницю між ``*`` і ``+``; ``*`` відповідає *нуль* "
"або більше разів, тому все, що повторюється, може взагалі не бути присутнім, "
"тоді як ``+`` вимагає принаймні *одного* входження. Щоб використати подібний "
"приклад, ``ca+t`` відповідатиме ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 "
"``'a'``\\ s), але не відповідатиме ``'ct``."
msgid ""
"There are two more repeating operators or quantifiers. The question mark "
"character, ``?``, matches either once or zero times; you can think of it as "
"marking something as being optional. For example, ``home-?brew`` matches "
"either ``'homebrew'`` or ``'home-brew'``."
msgstr ""
"Є ще два повторювані оператори або квантори. Знак питання, ``?``, збігається "
"або один раз, або нуль разів; ви можете розглядати це як позначення чогось "
"як необов’язкового. Наприклад, ``home-?brew`` matches either ``'homebrew'`` "
"або ``'home-brew'``."
msgid ""
"The most complicated quantifier is ``{m,n}``, where *m* and *n* are decimal "
"integers. This quantifier means there must be at least *m* repetitions, and "
"at most *n*. For example, ``a/{1,3}b`` will match ``'a/b'``, ``'a//b'``, "
"and ``'a///b'``. It won't match ``'ab'``, which has no slashes, or ``'a////"
"b'``, which has four."
msgstr ""
"Найскладнішим квантором є ``{m,n}``, де *m* і *n* є десятковими цілими "
"числами. Цей квантор означає, що має бути принаймні *m* повторень і не "
"більше *n*. Наприклад, ``a/{1,3}b`` відповідатиме ``'a/b'``, ``'a//b'``, та "
"``'a///b'``. Він не збігатиметься з ``'ab'``, який не має похилих рисок, або "
"``'a////b'``, який має чотири."
msgid ""
"You can omit either *m* or *n*; in that case, a reasonable value is assumed "
"for the missing value. Omitting *m* is interpreted as a lower limit of 0, "
"while omitting *n* results in an upper bound of infinity."
msgstr ""
"Ви можете опустити *m* або *n*; у цьому випадку для відсутнього значення "
"приймається розумне значення. Пропуск *m* інтерпретується як нижня межа 0, "
"тоді як пропуск *n* призводить до верхньої межі нескінченності."
msgid ""
"The simplest case ``{m}`` matches the preceding item exactly *m* times. For "
"example, ``a/{2}b`` will only match ``'a//b'``."
msgstr ""
msgid ""
"Readers of a reductionist bent may notice that the three other quantifiers "
"can all be expressed using this notation. ``{0,}`` is the same as ``*``, "
"``{1,}`` is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's "
"better to use ``*``, ``+``, or ``?`` when you can, simply because they're "
"shorter and easier to read."
msgstr ""
"Редукціоністські читачі можуть помітити, що всі три інші квантори можна "
"виразити за допомогою цієї нотації. ``{0,}`` те саме, що ` ``*``, ``{1,}`` "
"еквівалентно ``+``, and ``{0,1}`` is the same as ``?``. Краще "
"використовувати ``*``, ``+``, або ``?``, коли є така можливість, просто "
"тому, що вони коротші та легші для читання."
msgid "Using Regular Expressions"
msgstr "Використання регулярних виразів"
msgid ""
"Now that we've looked at some simple regular expressions, how do we actually "
"use them in Python? The :mod:`re` module provides an interface to the "
"regular expression engine, allowing you to compile REs into objects and then "
"perform matches with them."
msgstr ""
"Тепер, коли ми розглянули деякі прості регулярні вирази, як ми насправді "
"використовуємо їх у Python? Модуль :mod:`re` надає інтерфейс механізму "
"регулярних виразів, дозволяючи вам компілювати RE в об’єкти, а потім "
"виконувати з ними збіги."
msgid "Compiling Regular Expressions"
msgstr "Компіляція регулярних виразів"
msgid ""
"Regular expressions are compiled into pattern objects, which have methods "
"for various operations such as searching for pattern matches or performing "
"string substitutions. ::"
msgstr ""
"Регулярні вирази компілюються в об’єкти шаблонів, які мають методи для "
"різноманітних операцій, таких як пошук збігів шаблону або виконання "
"підстановок рядків. ::"
msgid ""
">>> import re\n"
">>> p = re.compile('ab*')\n"
">>> p\n"
"re.compile('ab*')"
msgstr ""
msgid ""
":func:`re.compile` also accepts an optional *flags* argument, used to enable "
"various special features and syntax variations. We'll go over the available "
"settings later, but for now a single example will do::"
msgstr ""
":func:`re.compile` також приймає необов’язковий аргумент *flags*, який "
"використовується для ввімкнення різних спеціальних функцій і варіантів "
"синтаксису. Пізніше ми розглянемо доступні параметри, а поки підійде один "
"приклад:"
msgid ">>> p = re.compile('ab*', re.IGNORECASE)"
msgstr ""
msgid ""
"The RE is passed to :func:`re.compile` as a string. REs are handled as "
"strings because regular expressions aren't part of the core Python language, "
"and no special syntax was created for expressing them. (There are "
"applications that don't need REs at all, so there's no need to bloat the "
"language specification by including them.) Instead, the :mod:`re` module is "
"simply a C extension module included with Python, just like the :mod:"
"`socket` or :mod:`zlib` modules."
msgstr ""
"RE передається до :func:`re.compile` як рядок. RE обробляються як рядки, "
"оскільки регулярні вирази не є частиною основної мови Python, і для їх "
"вираження не створено спеціального синтаксису. (Існують програми, які "
"взагалі не потребують RE, тому немає потреби роздувати специфікацію мови, "
"включаючи їх.) Натомість модуль :mod:`re` є просто модулем розширення C, що "
"входить до складу Python, як і модулі :mod:`socket` або :mod:`zlib`."
msgid ""
"Putting REs in strings keeps the Python language simpler, but has one "
"disadvantage which is the topic of the next section."
msgstr ""
"Розміщення RE в рядках робить мову Python простішою, але має один недолік, "
"який є темою наступного розділу."
msgid "The Backslash Plague"
msgstr "Зворотна коса чума"
msgid ""
"As stated earlier, regular expressions use the backslash character "
"(``'\\'``) to indicate special forms or to allow special characters to be "
"used without invoking their special meaning. This conflicts with Python's "
"usage of the same character for the same purpose in string literals."
msgstr ""
"Як було сказано раніше, у регулярних виразах використовується символ "
"зворотної косої риски (``'\\'``), щоб позначити спеціальні форми або "
"дозволити використовувати спеціальні символи без виклику їх особливого "
"значення. Це суперечить використанню Python того самого символу для тієї ж "
"мети в рядкових літералах."
msgid ""
"Let's say you want to write a RE that matches the string ``\\section``, "
"which might be found in a LaTeX file. To figure out what to write in the "
"program code, start with the desired string to be matched. Next, you must "
"escape any backslashes and other metacharacters by preceding them with a "
"backslash, resulting in the string ``\\\\section``. The resulting string "
"that must be passed to :func:`re.compile` must be ``\\\\section``. However, "
"to express this as a Python string literal, both backslashes must be escaped "
"*again*."
msgstr ""
"Припустімо, ви хочете написати RE, який відповідає рядку ``\\section``, який "
"можна знайти у файлі LaTeX. Щоб зрозуміти, що писати в коді програми, "
"почніть із потрібного рядка, який потрібно знайти. Далі ви повинні уникнути "
"будь-яких зворотних похилих рисок та інших метасимволів, поставивши перед "
"ними зворотну похилу риску, що призведе до рядка ``\\\\section``. Отриманий "
"рядок, який потрібно передати в :func:`re.compile`, має бути ``\\"
"\\section``. Однак, щоб виразити це як рядковий літерал Python, обидві "
"зворотні похилі риски потрібно екранувати *знову*."
msgid "Characters"
msgstr "Персонажі"
msgid "Stage"
msgstr "етап"
msgid "``\\section``"
msgstr "``\\розділ``"
msgid "Text string to be matched"
msgstr "Текстовий рядок, який потрібно знайти"
msgid "``\\\\section``"
msgstr "``\\\\розділ``"
msgid "Escaped backslash for :func:`re.compile`"
msgstr "Екранований зворотний слеш для :func:`re.compile`"
msgid "``\"\\\\\\\\section\"``"
msgstr "``\"\\\\\\\\розділ\"``"
msgid "Escaped backslashes for a string literal"
msgstr "Екрановані зворотні косі риски для рядкового літералу"
msgid ""
"In short, to match a literal backslash, one has to write ``'\\\\\\\\'`` as "
"the RE string, because the regular expression must be ``\\\\``, and each "
"backslash must be expressed as ``\\\\`` inside a regular Python string "
"literal. In REs that feature backslashes repeatedly, this leads to lots of "
"repeated backslashes and makes the resulting strings difficult to understand."
msgstr ""
"Коротше кажучи, щоб відповідати буквальному зворотному слешу, потрібно "
"написати ``'\\\\\\\\'`` як рядок RE, тому що регулярний вираз має бути ``\\"
"\\``, а кожен зворотний слеш має бути виражений як ``\\\\`` всередині "
"звичайного рядкового літералу Python. У RE, які неодноразово містять "
"зворотні косі риски, це призводить до великої кількості повторюваних "
"зворотних косих риск і ускладнює розуміння результуючих рядків."
msgid ""
"The solution is to use Python's raw string notation for regular expressions; "
"backslashes are not handled in any special way in a string literal prefixed "
"with ``'r'``, so ``r\"\\n\"`` is a two-character string containing ``'\\'`` "
"and ``'n'``, while ``\"\\n\"`` is a one-character string containing a "
"newline. Regular expressions will often be written in Python code using this "
"raw string notation."
msgstr ""
"Рішення полягає у використанні необробленої рядкової нотації Python для "
"регулярних виразів; зворотні косі риски не обробляються спеціальним чином у "
"рядковому літералі з префіксом ``'r'``, тому ``r\"\\n\"`` є двосимвольним "
"рядком, що містить ``'\\'`` і ``' n'``, тоді як ``\"\\n\"`` є односимвольним "
"рядком, що містить новий рядок. Регулярні вирази часто записуються в коді "
"Python з використанням цієї необробленої рядкової нотації."
msgid ""
"In addition, special escape sequences that are valid in regular expressions, "
"but not valid as Python string literals, now result in a :exc:"
"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which "
"means the sequences will be invalid if raw string notation or escaping the "
"backslashes isn't used."
msgstr ""
"Крім того, спеціальні керуючі послідовності, дійсні в регулярних виразах, "
"але недійсні як рядкові літерали Python, тепер призводять до :exc:"
"`DeprecationWarning` і згодом стануть :exc:`SyntaxError`, що означає, що "
"послідовності будуть недійсними якщо не використовується необроблений "
"рядковий запис або екранування зворотних скісних риск."
msgid "Regular String"
msgstr "Звичайний рядок"
msgid "Raw string"
msgstr "Необроблений рядок"
msgid "``\"ab*\"``"
msgstr "``\"ab*\"``"
msgid "``r\"ab*\"``"
msgstr "``r\"ab*\"``"
msgid "``r\"\\\\section\"``"
msgstr "``r\"\\\\розділ\"``"
msgid "``\"\\\\w+\\\\s+\\\\1\"``"
msgstr "``\"\\\\w+\\\\s+\\\\1\"``"
msgid "``r\"\\w+\\s+\\1\"``"
msgstr "``r\"\\w+\\s+\\1\"``"
msgid "Performing Matches"
msgstr "Виконання матчів"
msgid ""
"Once you have an object representing a compiled regular expression, what do "
"you do with it? Pattern objects have several methods and attributes. Only "
"the most significant ones will be covered here; consult the :mod:`re` docs "
"for a complete listing."
msgstr ""
"Якщо у вас є об’єкт, що представляє скомпільований регулярний вираз, що ви з "
"ним робите? Об’єкти шаблонів мають кілька методів і атрибутів. Тут будуть "
"розглянуті лише найважливіші з них; зверніться до документів :mod:`re` для "
"отримання повного списку."
msgid "Method/Attribute"
msgstr "Метод/атрибут"
msgid "Purpose"
msgstr "призначення"
msgid "``match()``"
msgstr "``match()``"
msgid "Determine if the RE matches at the beginning of the string."
msgstr "Визначте, чи відповідає RE на початку рядка."
msgid "``search()``"
msgstr "``search()``"
msgid "Scan through a string, looking for any location where this RE matches."
msgstr "Проскануйте рядок, шукаючи будь-яке місце, де цей RE відповідає."
msgid "``findall()``"
msgstr "``findall()``"
msgid "Find all substrings where the RE matches, and returns them as a list."
msgstr ""
"Знайти всі підрядки, де відповідає RE, і повернути їх у вигляді списку."
msgid "``finditer()``"
msgstr "``finditer()``"
msgid ""
"Find all substrings where the RE matches, and returns them as an :term:"
"`iterator`."
msgstr ""
"Знайти всі підрядки, де відповідає RE, і повернути їх як :term:`iterator`."
msgid ""
":meth:`~re.Pattern.match` and :meth:`~re.Pattern.search` return ``None`` if "
"no match can be found. If they're successful, a :ref:`match object <match-"
"objects>` instance is returned, containing information about the match: "
"where it starts and ends, the substring it matched, and more."
msgstr ""
":meth:`~re.Pattern.match` і :meth:`~re.Pattern.search` повертають ``None``, "
"якщо збіг не знайдено. Якщо вони успішні, повертається екземпляр :ref:`match "
"object <match-objects>`, який містить інформацію про збіг: де він "
"починається і закінчується, підрядок, з яким він збігся, тощо."
msgid ""
"You can learn about this by interactively experimenting with the :mod:`re` "
"module."
msgstr ""
"Ви можете дізнатися про це, інтерактивно поекспериментувавши з модулем :mod:"
"`re`."
msgid ""
"This HOWTO uses the standard Python interpreter for its examples. First, run "
"the Python interpreter, import the :mod:`re` module, and compile a RE::"
msgstr ""
"Цей HOWTO використовує стандартний інтерпретатор Python для своїх прикладів. "
"Спочатку запустіть інтерпретатор Python, імпортуйте модуль :mod:`re` і "
"скомпілюйте RE::"
msgid ""
">>> import re\n"
">>> p = re.compile('[a-z]+')\n"
">>> p\n"
"re.compile('[a-z]+')"
msgstr ""
msgid ""
"Now, you can try matching various strings against the RE ``[a-z]+``. An "
"empty string shouldn't match at all, since ``+`` means 'one or more "
"repetitions'. :meth:`~re.Pattern.match` should return ``None`` in this case, "
"which will cause the interpreter to print no output. You can explicitly "
"print the result of :meth:`!match` to make this clear. ::"
msgstr ""
"Тепер ви можете спробувати зіставити різні рядки з RE ``[a-z]+``. Порожній "
"рядок взагалі не повинен збігатися, оскільки ``+`` означає 'одне або більше "
"повторень'. :meth:`~re.Pattern.match` має повернути ``None`` у цьому "
"випадку, що призведе до того, що інтерпретатор не друкуватиме вихідні дані. "
"Ви можете явно надрукувати результат :meth:`!match`, щоб це було "
"зрозуміло. ::"
msgid ""
">>> p.match(\"\")\n"
">>> print(p.match(\"\"))\n"
"None"
msgstr ""
msgid ""
"Now, let's try it on a string that it should match, such as ``tempo``. In "
"this case, :meth:`~re.Pattern.match` will return a :ref:`match object <match-"
"objects>`, so you should store the result in a variable for later use. ::"
msgstr ""
"Тепер давайте спробуємо це на рядку, який має збігатися, наприклад "
"``tempo``. У цьому випадку :meth:`~re.Pattern.match` поверне :ref:`об’єкт "
"відповідності <match-objects>`, тому ви повинні зберегти результат у змінній "
"для подальшого використання. ::"
msgid ""
">>> m = p.match('tempo')\n"
">>> m\n"
"<re.Match object; span=(0, 5), match='tempo'>"
msgstr ""
msgid ""
"Now you can query the :ref:`match object <match-objects>` for information "
"about the matching string. Match object instances also have several methods "
"and attributes; the most important ones are:"
msgstr ""
"Тепер ви можете запитати :ref:`match object <match-objects>` для отримання "
"інформації про відповідний рядок. Екземпляри об’єктів зіставлення також "
"мають кілька методів і атрибутів; найважливіші з них:"
msgid "``group()``"
msgstr "``group()``"
msgid "Return the string matched by the RE"
msgstr "Повертає рядок, який відповідає RE"
msgid "``start()``"
msgstr "``start()``"
msgid "Return the starting position of the match"
msgstr "Повернути вихідну позицію матчу"
msgid "``end()``"
msgstr "``end()``"
msgid "Return the ending position of the match"
msgstr "Повернення кінцевої позиції матчу"
msgid "``span()``"
msgstr "``span()``"
msgid "Return a tuple containing the (start, end) positions of the match"
msgstr "Повертає кортеж, що містить (початкову, кінцеву) позиції збігу"
msgid "Trying these methods will soon clarify their meaning::"
msgstr "Спроба цих методів незабаром прояснить їх значення:"
msgid ""
">>> m.group()\n"
"'tempo'\n"
">>> m.start(), m.end()\n"
"(0, 5)\n"
">>> m.span()\n"
"(0, 5)"
msgstr ""
msgid ""
":meth:`~re.Match.group` returns the substring that was matched by the RE. :"
"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and "
"ending index of the match. :meth:`~re.Match.span` returns both start and end "
"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only "
"checks if the RE matches at the start of a string, :meth:`!start` will "
"always be zero. However, the :meth:`~re.Pattern.search` method of patterns "
"scans through the string, so the match may not start at zero in that "
"case. ::"
msgstr ""
":meth:`~re.Match.group` повертає підрядок, який був зіставлений RE. :meth:"
"`~re.Match.start` і :meth:`~re.Match.end` повертають початковий і кінцевий "
"індекси збігу. :meth:`~re.Match.span` повертає початковий і кінцевий індекси "
"в одному кортежі. Оскільки метод :meth:`~re.Pattern.match` лише перевіряє, "
"чи відповідає RE на початку рядка, :meth:`!start` завжди дорівнюватиме нулю. "
"Однак метод шаблонів :meth:`~re.Pattern.search` сканує рядок, тому в цьому "
"випадку збіг може не початися з нуля. ::"
msgid ""
">>> print(p.match('::: message'))\n"
"None\n"
">>> m = p.search('::: message'); print(m)\n"
"<re.Match object; span=(4, 11), match='message'>\n"
">>> m.group()\n"
"'message'\n"
">>> m.span()\n"
"(4, 11)"
msgstr ""
msgid ""
"In actual programs, the most common style is to store the :ref:`match object "
"<match-objects>` in a variable, and then check if it was ``None``. This "
"usually looks like::"
msgstr ""
"У реальних програмах найпоширенішим стилем є збереження :ref:`match object "
"<match-objects>` у змінній, а потім перевірка, чи вона була ``None``. "
"Зазвичай це виглядає так::"
msgid ""
"p = re.compile( ... )\n"
"m = p.match( 'string goes here' )\n"
"if m:\n"
" print('Match found: ', m.group())\n"
"else:\n"
" print('No match')"
msgstr ""
msgid ""
"Two pattern methods return all of the matches for a pattern. :meth:`~re."
"Pattern.findall` returns a list of matching strings::"
msgstr ""
"Два методи шаблону повертають усі збіги шаблону. :meth:`~re.Pattern.findall` "
"повертає список відповідних рядків::"
msgid ""
">>> p = re.compile(r'\\d+')\n"
">>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')\n"
"['12', '11', '10']"
msgstr ""
msgid ""
"The ``r`` prefix, making the literal a raw string literal, is needed in this "
"example because escape sequences in a normal \"cooked\" string literal that "
"are not recognized by Python, as opposed to regular expressions, now result "
"in a :exc:`DeprecationWarning` and will eventually become a :exc:"
"`SyntaxError`. See :ref:`the-backslash-plague`."
msgstr ""
"Префікс ``r``, який робить літерал необробленим рядковим літералом, потрібен "
"у цьому прикладі, тому що escape-послідовності у звичайному \"вареному\" "
"рядковому літералі, які не розпізнаються Python, на відміну від регулярних "
"виразів, тепер призводять до :exc:`DeprecationWarning` і з часом стане :exc:"
"`SyntaxError`. Дивіться :ref:`the-backslash-plague`."
msgid ""
":meth:`~re.Pattern.findall` has to create the entire list before it can be "
"returned as the result. The :meth:`~re.Pattern.finditer` method returns a "
"sequence of :ref:`match object <match-objects>` instances as an :term:"
"`iterator`::"
msgstr ""
":meth:`~re.Pattern.findall` має створити весь список, перш ніж його можна "
"буде повернути як результат. Метод :meth:`~re.Pattern.finditer` повертає "
"послідовність екземплярів :ref:`match object <match-objects>` як :term:"
"`iterator`::"
msgid ""
">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n"
">>> iterator\n"
"<callable_iterator object at 0x...>\n"
">>> for match in iterator:\n"
"... print(match.span())\n"
"...\n"
"(0, 2)\n"