Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve replace and replace_all docstring explanation of the "$" character with reference to capture groups (vs use as a literal) #19529

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Oct 30, 2024

Closes #19527 (and #19523).

The explanation relating to use of "$" (as part of a capture group reference vs use as a literal in the replacement value) was a little ambiguous/incomplete. Have made the explanation (given in the "Notes" section) clearer, with an illustrative example for each replace and replace_all function.

Updated docs, example:

image

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars labels Oct 30, 2024
@alexander-beedie alexander-beedie changed the title docs: Improve explanation of the $ character with reference to capture groups (vs use as a literal) docs: Improve replace and replace_all explanation of the $ character with reference to capture groups (vs use as a literal) Oct 30, 2024
@alexander-beedie alexander-beedie changed the title docs: Improve replace and replace_all explanation of the $ character with reference to capture groups (vs use as a literal) docs: Improve replace and replace_all explanation of the "$" character with reference to capture groups (vs use as a literal) Oct 30, 2024
@alexander-beedie alexander-beedie changed the title docs: Improve replace and replace_all explanation of the "$" character with reference to capture groups (vs use as a literal) docs: Improve replace and replace_all docstring explanation of the "$" character with reference to capture groups (vs use as a literal) Oct 30, 2024
Copy link
Collaborator

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearer, indeed.

@alexander-beedie alexander-beedie merged commit 047e578 into pola-rs:main Nov 5, 2024
25 of 26 checks passed
@alexander-beedie alexander-beedie deleted the improve-regex-replace-docs branch November 5, 2024 11:44
tylerriccio33 pushed a commit to tylerriccio33/polars that referenced this pull request Nov 8, 2024
…e "$" character with reference to capture groups (vs use as a literal) (pola-rs#19529)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regex replace should mention $ escaping is only for substitution
2 participants