summaryrefslogtreecommitdiffstats
path: root/Doc/library/re.rst
Commit message (Collapse)AuthorAgeFilesLines
* gh-124130: Notes on empty string corner case of category `\B` (#124133)Y52024-09-231-0/+6
| | | | Signed-off-by: y5c4l3 <y5c4l3@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-118508: Clarify which characters are matched by `\s` (#119155)Nice Zombies2024-09-021-4/+3
| | | Clarify re syntax
* gh-111259: Document idiomatic RE pattern (?s:.) that matches any character ↵Serhiy Storchaka2024-06-201-1/+1
| | | | (GH-120745)
* gh-119960: Add information about regex flags in re module functions (#119978)Awbert2024-06-191-0/+32
|
* docs: module page titles should not start with a link to themselves (#117099)Ned Batchelder2024-05-081-2/+2
|
* Docs: add link roles with Sphinx extlinks (#117850)Hugo van Kemenade2024-04-151-1/+1
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-101699: Explain using Match.expand with \g<0> (GH-101701)Stevoisiak2024-02-171-1/+2
| | | | | | | Update documentation for re library to explain that a backreference `\g<0>` is expanded to the entire string when using Match.expand(). Note that numeric backreferences to group 0 (`\0`) are not supported. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-115172: Fix explicit index extries for the C API (GH-115173)Serhiy Storchaka2024-02-111-1/+1
|
* gh-114332: Fix the flags reference for ``re.compile()`` (#114334)David H. Gutteridge2024-01-201-2/+2
| | | | | | | The GH-93000 change set inadvertently caused a sentence in re.compile() documentation to refer to details that no longer followed. Correct this with a link to the Flags sub-subsection. Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* GH-107678: Improve Unicode handling clarity in ``library/re.rst`` (#107679)Adam Turner2024-01-111-92/+145
|
* GH-83162: Rename re.error for better clarity. (#101677)achhina2023-12-111-2/+6
| | | | | | | | | Renamed re.error for clarity, and kept re.error for backward compatibility. Updated idlelib files at TJR's request. --------- Co-authored-by: Matthias Bussonnier <mbussonnier@ucmerced.edu> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-110631: Fix reST indentation in `Doc/library` (#110685)Ezio Melotti2023-10-111-1/+1
| | | Fix wrong indentation in the Doc/library dir.
* gh-109634: Use :samp: role (GH-109635)Serhiy Storchaka2023-09-231-1/+1
|
* gh-102211: Document `re.{Pattern,Match}`’s existence (#102212)Philipp A2023-08-251-30/+37
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-56166: Deprecate passing confusing positional arguments in re functions ↵Serhiy Storchaka2023-08-161-11/+13
| | | | | | | (#107778) Deprecate passing optional arguments maxsplit, count and flags in module-level functions re.split(), re.sub() and re.subn() as positional. They should only be passed by keyword.
* gh-102111: Add link to string escape sequences in re module (#106995)wulmer2023-07-231-2/+2
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Fix Sphinx warnings in `re` module docs (#107044)wulmer2023-07-221-5/+18
|
* gh-102259: Fix re doc issue regarding right square brackets (#102264)Skip Montanaro2023-02-261-1/+2
| | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-99308: Clarify re docs for byte pattern group names (#99311)Ilya Kulakov2022-12-251-7/+9
|
* gh-69929: re docs: Add more specific definition of \w (#92015)Stanley2022-12-201-4/+3
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-99087: Add missing newline for prompts in docs (GH-98993)Stanley2022-12-091-0/+2
| | | Add newline for prompts so copying to REPL does not cause errors.
* GH-98906 ```re``` module: ```search() vs. match()``` section should mention ↵ram vikram singh2022-11-301-6/+12
| | | | | ```fullmatch()``` (GH-98916) Mention fullmatch along with search and match.
* gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)Victor Stinner2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence), use raw strings for regular expression: re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. Octal escapes with value larger than 0o377 (ex: "\477"), deprecated in Python 3.11, now produce a SyntaxWarning, instead of DeprecationWarning. In a future Python version they will be eventually a SyntaxError. codecs.escape_decode() and codecs.unicode_escape_decode() are left unchanged: they still emit DeprecationWarning. * The parser only emits SyntaxWarning for Python 3.12 (feature version), and still emits DeprecationWarning on older Python versions. * Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and wasm_build.py.
* gh-98740: Fix validation of conditional expressions in RE (GH-98764)Serhiy Storchaka2022-11-031-0/+3
| | | | | | | | | | | In very rare circumstances the JUMP opcode could be confused with the argument of the opcode in the "then" part which doesn't end with the JUMP opcode. This led to incorrect detection of the final JUMP opcode and incorrect calculation of the size of the subexpression. NOTE: Changed return value of functions _validate_inner() and _validate_charset() in Modules/_sre/sre.c. Now they return 0 on success, -1 on failure, and 1 if the last op is JUMP (which usually is a failure). Previously they returned 1 on success and 0 on failure.
* Add re.VERBOSE flag documentation example (#97678)Athos Ribeiro2022-10-051-1/+2
| | | | | | The current re.VERBOSE documentation example leaves space for ambiguous interpretation. One may read that spaces within the `(?:` token are spaces inside the non-capturing group (such as `(?: )`). This patch removes the ambiguity by including examples after the statement.
* gh-92727: Add example of named group in doc for re.Match.__getitem__ (#92730)Baptiste Mispelon2022-05-281-0/+8
|
* gh-73137: Added sub-subsection headers for flags in re (#93000)Stanley2022-05-231-30/+42
| | | Fixes #73137
* re docs: fix source code link (#92819)谭九鼎2022-05-171-1/+1
|
* gh-91760: More strict rules for numerical group references and group names ↵Serhiy Storchaka2022-05-081-8/+11
| | | | | | | | in RE (GH-91792) Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore.
* gh-91760: Deprecate group names and numbers which will be invalid in future ↵Serhiy Storchaka2022-04-301-0/+10
| | | | | | | | (GH-91794) Only sequence of ASCII digits will be accepted as a numerical reference. The group name in bytes patterns and replacement strings could only contain ASCII letters and digits and underscore.
* chore/docs: fix rst style and typo (GH-32331)谭九鼎2022-04-051-6/+6
| | | | | | | | | | | | | Current: ![图片](https://user-images.githubusercontent.com/24759802/161704413-30fc91e8-ccd1-4617-8483-bc54ec970f30.png) After this change: ![图片](https://user-images.githubusercontent.com/24759802/161704636-a5458192-a93a-40af-8bde-90ba80fdb53f.png) Trivial so I don't think it needs news or issue Automerge-Triggered-By: GH:JulienPalard
* bpo-47081: Replace "qualifiers" with "quantifiers" in the re module ↵Serhiy Storchaka2022-03-221-8/+8
| | | | | documentation (GH-32028) It is a more commonly used term.
* bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)Serhiy Storchaka2022-03-211-0/+54
| | | | | | | | * Atomic grouping: (?>...). * Possessive quantifiers: x++, x*+, x?+, x{m,n}+. Equivalent to (?>x+), (?>x*), (?>x?), (?>x{m,n}). Co-authored-by: Jeffrey C. Jacobs <timehorse@users.sourceforge.net>
* bpo-47066: Convert a warning about flags not at the start of the regular ↵Serhiy Storchaka2022-03-191-0/+3
| | | | expression into error (GH-31994)
* bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)andrei kulakov2022-02-051-0/+16
| | | | | * added RegexFlag to re.__all__; added RegexFlag.NOFLAG Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* Fix the "Finding all Adverbs" example (GH-21420)Rim Chatti2021-10-091-2/+2
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44940: Clarify the documentation of re.findall() (GH-27849)Serhiy Storchaka2021-08-221-4/+14
| | | | | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Vedran Čačić <vedgar+github@gmail.com>
* Update URLs in comments and metadata to use HTTPS (GH-27458)Noah Kantrowitz2021-07-301-2/+2
|
* Minor modernization and readability improvement to the tokenizer example ↵Raymond Hettinger2020-04-171-2/+6
| | | | (GH-19558)
* bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. ↵Ricardo Bánffy2019-10-071-3/+5
| | | | | | | | | (GH-16442) Prior to 3.7, re.escape escaped many characters that don't have special meaning in Python, but that use to require escaping in other tools and languages. This commit aims to make it clear which characters were, but are no longer escaped.
* Doc: Fix missing negation. (GH-14640)Julien Palard2019-09-111-2/+2
| | | | | | | Reported by Hug Capella on docs@. Automerge-Triggered-By: @matrixise
* Fix typo in re.escape documentation (GH-14722)Robert DiPietro2019-07-131-1/+1
|
* bpo-36645: Fix ambiguous formatting in re.sub() documentation (GH-12879)mollison2019-04-211-0/+1
|
* bpo-28450: Fix and improve the documentation for unknown escapes in RE. ↵Serhiy Storchaka2019-02-251-2/+5
| | | | (GH-11920)
* bpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546)animalize2019-02-181-0/+2
| | | | | | Need to reset capturing groups between two SRE(match) callings in loops, this fixes wrong capturing groups in rare cases. Also add a missing index in re.rst.
* Add information about DeprecationWarning for invalid escaped characters in ↵Pablo Galindo2019-01-201-1/+4
| | | | the re module (GH-5255)
* Cleanup and improve the regex tokenizer example. (GH-10426)Raymond Hettinger2018-11-091-36/+38
| | | | | | | | | | | 1) Convert weird field name "typ" to the more standard "type". 2) For the NUMBER type, convert the value to an int() or float(). 3) Simplify ``group(kind)`` to the shorter and faster ``group()`` call. 4) Simplify logic go a single if-elif chain to make this easier to extend. 5) Reorder the tests to match the order the tokens are specified. This isn't necessary for correctness but does make the example easier to follow. 6) Move the "column" calculation before the if-elif chain so that users have the option of using this value in error messages.
* bpo-35054: Add yet more index entries for symbols. (GH-10121)Serhiy Storchaka2018-10-281-19/+16
|
* bpo-35054: Add more index entries for symbols. (GH-10064)Serhiy Storchaka2018-10-261-0/+100
|
* bpo-34962: make doctest in Doc/ now passes, and is enforced in CI (GH-9806)Stéphane Wirtel2018-10-121-7/+6
|